*/
enum Usage
{
- MULTIPR_USAGE_UNKNOWN,
- MULTIPR_USAGE_DISPLAY_HELP,
- MULTIPR_USAGE_AUTOTEST,
- MULTIPR_USAGE_PARTITION1,
- MULTIPR_USAGE_PARTITION2,
- MULTIPR_USAGE_DECIMATION,
- MULTIPR_USAGE_INFO
+ MULTIPR_USAGE_UNKNOWN,
+ MULTIPR_USAGE_DISPLAY_HELP,
+ MULTIPR_USAGE_AUTOTEST,
+ MULTIPR_USAGE_PARTITION1,
+ MULTIPR_USAGE_PARTITION2,
+ MULTIPR_USAGE_DECIMATION,
+ MULTIPR_USAGE_INFO
};
*/
enum Error
{
- MULTIPR_APP_NO_ERROR,
- MULTIPR_APP_UNKNOWN_USAGE,
- MULTIPR_APP_WRONG_NUMBER_OF_ARGUMENTS,
- MULTIPR_APP_ILLEGAL_ARGUMENT,
- MULTIPR_APP_FILE_NOT_FOUND,
- MULTIPR_APP_IO_ERROR,
- MULTIPR_APP_UNDEFINED_ERROR
+ MULTIPR_APP_NO_ERROR,
+ MULTIPR_APP_UNKNOWN_USAGE,
+ MULTIPR_APP_WRONG_NUMBER_OF_ARGUMENTS,
+ MULTIPR_APP_ILLEGAL_ARGUMENT,
+ MULTIPR_APP_FILE_NOT_FOUND,
+ MULTIPR_APP_IO_ERROR,
+ MULTIPR_APP_UNDEFINED_ERROR
};
*/
const char* getUsage(int usage)
{
- switch(usage)
- {
- case MULTIPR_USAGE_DISPLAY_HELP:
- return "--help: display help";
-
- case MULTIPR_USAGE_AUTOTEST:
- return "--auto: unit tests";
-
- case MULTIPR_USAGE_PARTITION1:
- return "--part1: extract all groups of a sequential MED file";
-
- case MULTIPR_USAGE_PARTITION2:
- return "--part2: split a part of a distributed MED file";
-
- case MULTIPR_USAGE_DECIMATION:
- return "--decim: generated level of details of a part of a distributed MED file";
-
- case MULTIPR_USAGE_INFO:
- return "--info: prints all infos about a mesh in a sequential MED file";
-
- default:
- return "unknown";
- }
+ switch(usage)
+ {
+ case MULTIPR_USAGE_DISPLAY_HELP:
+ return "--help: display help";
+
+ case MULTIPR_USAGE_AUTOTEST:
+ return "--auto: perform all unit tests";
+
+ case MULTIPR_USAGE_PARTITION1:
+ return "--part1: extract all groups of a sequential MED file";
+
+ case MULTIPR_USAGE_PARTITION2:
+ return "--part2: split a part of a distributed MED file";
+
+ case MULTIPR_USAGE_DECIMATION:
+ return "--decim: generated level of details of a part of a distributed MED file";
+
+ case MULTIPR_USAGE_INFO:
+ return "--info: prints all infos about a mesh in a sequential MED file";
+
+ default:
+ return "unknown";
+ }
}
*/
void printDescription()
{
- cout << "Keywords:" << endl;
- cout << " Post-processing numerical simulation, Salome platform, " << endl;
- cout << " Large data set visualization, 3D meshes and fields" << endl;
- cout << "Description:" << endl;
- cout << " multipr is a partitionning/decimation tool of MED files." << endl;
- cout << " See http://www.salome-platform.org for information about MED or Salome." << endl;
- cout << " Note: current version only accept TETRA10 meshes." << endl;
+ cout << "Keywords:" << endl;
+ cout << " Post-processing numerical simulation, Salome platform, " << endl;
+ cout << " Large data set visualization, 3D meshes and fields" << endl;
+ cout << "Description:" << endl;
+ cout << " multipr is a partitionning/decimation tool of MED files." << endl;
+ cout << " See http://www.salome-platform.org for information about MED or Salome." << endl;
+ cout << " Note: current version only accept TETRA10 meshes." << endl;
}
*/
void printUsage()
{
- cout << "Usages:" << endl;
- cout << " --auto Autotest: performs some unit tests on the MULTIPR API" << endl;
- cout << " * Usage: --auto path (path where to find test file \"agregat100grains_12pas.med\")" << endl;
- cout << " --part1 Extracts all groups from a sequential MED file (V2.2 or higher)" << endl;
- cout << " * Usage: --part1 file.med meshName" << endl;
- cout << " --part2 Split a group of a distributed MED file (V2.3) produced with --part1" << endl;
- cout << " * Usage: --part2 file.med partName nbParts [splitter (0=METIS 1=SCOTCH)]" << endl;
- cout << " --decim Generates 3 level of details (full, medium and low) of a part" << endl;
- cout << " of a distributed MED file (V2.3)" << endl;
- cout << " * Usage: --decim file.med partName fieldName fieldIt filterName [...]" << endl;
- cout << " * Only one filter is currently available: Filtre_GradientMoyen" << endl;
- cout << " * Usage: --decim file.med partName fieldName fieldIt Filtre_GradientMoyen m l radius" << endl;
- cout << " where m=threshold for medium res. and l=threshold for low res.; assume m < l" << endl;
- cout << " --info Dumps all infos related to a mesh in a sequential MED file" << endl;
- cout << " * Usage: --info file.med [meshName]" << endl;
- cout << " --help Displays this help page" << endl;
- cout << endl;
+ cout << "Usages:" << endl;
+ cout << " --auto Autotest: performs some unit tests on the MULTIPR API" << endl;
+ cout << " * Usage: --auto path (path where to find test file \"agregat100grains_12pas.med\")" << endl;
+ cout << " --part1 Extracts all groups from a sequential MED file (V2.2 or higher)" << endl;
+ cout << " * Usage: --part1 file.med meshName" << endl;
+ cout << " --part2 Split a group of a distributed MED file (V2.3) produced with --part1" << endl;
+ cout << " * Usage: --part2 file.med partName nbParts [splitter (0=METIS 1=SCOTCH)]" << endl;
+ cout << " --decim Generates 3 level of details (full, medium and low) of a part" << endl;
+ cout << " of a distributed MED file (V2.3)" << endl;
+ cout << " * Usage: --decim file.med partName fieldName fieldIt filterName [...]" << endl;
+ cout << " * Only one filter is currently available: Filtre_GradientMoyen" << endl;
+ cout << " * Usage: --decim file.med partName fieldName fieldIt Filtre_GradientMoyen m l radius" << endl;
+ cout << " where m=threshold for medium res. and l=threshold for low res.; assume m < l" << endl;
+ cout << " --info Dumps all infos related to a mesh in a sequential MED file" << endl;
+ cout << " * Usage: --info file.med [meshName]" << endl;
+ cout << " --help Displays this help page" << endl;
+ cout << endl;
}
*/
void printGlobals()
{
- cout << endl;
- cout << "********************************************************************************" << endl;
- cout << "CONFIGURATION" << endl;
- cout << "--------------------------------------------------------------------------------" << endl;
- cout << "Mode : " << getUsage(g_usage) << endl;
- cout << "Med filename : " << ((g_medFilename != NULL) ? g_medFilename : "UNDEFINED") << endl;
- cout << "Mesh name : " << ((g_meshName != NULL) ? g_meshName : "UNDEFINED") << endl;
- cout << "Part name : " << ((g_partName != NULL) ? g_partName : "UNDEFINED") << endl;
- cout << "Nb parts : " << g_nbParts << endl;
- cout << "Decimation:" << endl;
- cout << " Field name : " << ((g_fieldName != NULL) ? g_fieldName : "UNDEFINED") << endl;
- cout << " Time step iteration : " << g_fieldTimeStepIt << endl;
- cout << " Filter name : " << ((g_filterName != NULL) ? g_filterName : "UNDEFINED") << endl;
- cout << " Threshold for med. res. : " << g_decimThresholdMed << endl;
- cout << " Threshold for low res. : " << g_decimThresholdLow << endl;
- cout << " Radius : " << g_decimRadius << endl;
- cout << " Boxing : " << g_boxing << endl;
- cout << "********************************************************************************" << endl;
- cout << endl;
+ cout << endl;
+ cout << "********************************************************************************" << endl;
+ cout << "CONFIGURATION" << endl;
+ cout << "--------------------------------------------------------------------------------" << endl;
+ cout << "Mode : " << getUsage(g_usage) << endl;
+ cout << "Med filename : " << ((g_medFilename != NULL) ? g_medFilename : "UNDEFINED") << endl;
+ cout << "Mesh name : " << ((g_meshName != NULL) ? g_meshName : "UNDEFINED") << endl;
+ cout << "Part name : " << ((g_partName != NULL) ? g_partName : "UNDEFINED") << endl;
+ cout << "Nb parts : " << g_nbParts << endl;
+ cout << "Decimation:" << endl;
+ cout << " Field name : " << ((g_fieldName != NULL) ? g_fieldName : "UNDEFINED") << endl;
+ cout << " Time step iteration : " << g_fieldTimeStepIt << endl;
+ cout << " Filter name : " << ((g_filterName != NULL) ? g_filterName : "UNDEFINED") << endl;
+ cout << " Threshold for med. res. : " << g_decimThresholdMed << endl;
+ cout << " Threshold for low res. : " << g_decimThresholdLow << endl;
+ cout << " Radius : " << g_decimRadius << endl;
+ cout << " Boxing : " << g_boxing << endl;
+ cout << "********************************************************************************" << endl;
+ cout << endl;
}
*/
const char* getErrorMsg()
{
- switch (g_errorCode)
- {
- case MULTIPR_APP_NO_ERROR:
- return "no error";
-
- case MULTIPR_APP_UNKNOWN_USAGE:
- return "unknown usage";
-
- case MULTIPR_APP_WRONG_NUMBER_OF_ARGUMENTS:
- return "wrong number of arguments";
-
- case MULTIPR_APP_ILLEGAL_ARGUMENT:
- return "illegal argument";
-
- case MULTIPR_APP_FILE_NOT_FOUND:
- return "file not found";
-
- case MULTIPR_APP_IO_ERROR:
- return "i/o error";
-
- default:
- return "error (undefined)";
- }
+ switch (g_errorCode)
+ {
+ case MULTIPR_APP_NO_ERROR:
+ return "no error";
+
+ case MULTIPR_APP_UNKNOWN_USAGE:
+ return "unknown usage";
+
+ case MULTIPR_APP_WRONG_NUMBER_OF_ARGUMENTS:
+ return "wrong number of arguments";
+
+ case MULTIPR_APP_ILLEGAL_ARGUMENT:
+ return "illegal argument";
+
+ case MULTIPR_APP_FILE_NOT_FOUND:
+ return "file not found";
+
+ case MULTIPR_APP_IO_ERROR:
+ return "i/o error";
+
+ default:
+ return "error (undefined)";
+ }
}
*/
void parseCommandLine(int argc, char** argv)
{
- if (argc == 1)
- {
- g_usage = MULTIPR_USAGE_UNKNOWN;
- return;
- }
-
- if (strcmp(argv[1],"--help") == 0)
- {
- g_usage = MULTIPR_USAGE_DISPLAY_HELP;
- }
- else if (strcmp(argv[1],"--auto") == 0)
- {
- if (argc != 3)
- {
- g_usage = MULTIPR_USAGE_UNKNOWN;
- g_errorCode = MULTIPR_APP_WRONG_NUMBER_OF_ARGUMENTS;
- }
- else
- {
- g_usage = MULTIPR_USAGE_AUTOTEST;
- g_medFilename = argv[2];
- }
- }
- else if (strcmp(argv[1],"--part1") == 0)
- {
- if (argc != 4)
- {
- g_usage = MULTIPR_USAGE_UNKNOWN;
- g_errorCode = MULTIPR_APP_WRONG_NUMBER_OF_ARGUMENTS;
- }
- else
- {
- g_usage = MULTIPR_USAGE_PARTITION1;
- g_medFilename = argv[2];
- g_meshName = argv[3];
- }
- }
- else if (strcmp(argv[1],"--part2") == 0)
- {
- if ((argc != 5) && (argc != 6))
- {
- g_usage = MULTIPR_USAGE_UNKNOWN;
- g_errorCode = MULTIPR_APP_WRONG_NUMBER_OF_ARGUMENTS;
- }
- else
- {
- g_usage = MULTIPR_USAGE_PARTITION2;
- g_medFilename = argv[2];
- g_partName = argv[3];
- g_nbParts = atoi(argv[4]);
-
- if (argc == 6)
- {
- g_splitter = atoi(argv[5]);
- }
- }
- }
- else if (strcmp(argv[1],"--decim") == 0)
- {
- if ((argc != 10) && (argc != 11))
- {
- g_usage = MULTIPR_USAGE_UNKNOWN;
- g_errorCode = MULTIPR_APP_WRONG_NUMBER_OF_ARGUMENTS;
- }
- else
- {
- g_usage = MULTIPR_USAGE_DECIMATION;
- g_medFilename = argv[2];
- g_partName = argv[3];
- g_fieldName = argv[4];
- g_fieldTimeStepIt = atoi(argv[5]);
- g_filterName = argv[6];
- g_decimThresholdMed = atof(argv[7]);
- g_decimThresholdLow = atof(argv[8]);
- g_decimRadius = atof(argv[9]);
-
- if (argc == 11)
- {
- g_boxing = atoi(argv[10]);
- }
- }
- }
- else if (strcmp(argv[1],"--info") == 0)
- {
- if ((argc != 3) && (argc != 4))
- {
- g_usage = MULTIPR_USAGE_UNKNOWN;
- g_errorCode = MULTIPR_APP_WRONG_NUMBER_OF_ARGUMENTS;
- }
- else
- {
- g_usage = MULTIPR_USAGE_INFO;
- g_medFilename = argv[2];
-
- if (argc == 4)
- {
- g_meshName = argv[3];
- }
- }
- }
- else
- {
- g_usage = MULTIPR_USAGE_UNKNOWN;
- g_errorCode = MULTIPR_APP_UNKNOWN_USAGE;
- }
+ if (argc == 1)
+ {
+ g_usage = MULTIPR_USAGE_UNKNOWN;
+ return;
+ }
+
+ if (strcmp(argv[1],"--help") == 0)
+ {
+ g_usage = MULTIPR_USAGE_DISPLAY_HELP;
+ }
+ else if (strcmp(argv[1],"--auto") == 0)
+ {
+ if (argc != 3)
+ {
+ g_usage = MULTIPR_USAGE_UNKNOWN;
+ g_errorCode = MULTIPR_APP_WRONG_NUMBER_OF_ARGUMENTS;
+ }
+ else
+ {
+ g_usage = MULTIPR_USAGE_AUTOTEST;
+ g_medFilename = argv[2];
+ }
+ }
+ else if (strcmp(argv[1],"--part1") == 0)
+ {
+ if (argc != 4)
+ {
+ g_usage = MULTIPR_USAGE_UNKNOWN;
+ g_errorCode = MULTIPR_APP_WRONG_NUMBER_OF_ARGUMENTS;
+ }
+ else
+ {
+ g_usage = MULTIPR_USAGE_PARTITION1;
+ g_medFilename = argv[2];
+ g_meshName = argv[3];
+ }
+ }
+ else if (strcmp(argv[1],"--part2") == 0)
+ {
+ if ((argc != 5) && (argc != 6))
+ {
+ g_usage = MULTIPR_USAGE_UNKNOWN;
+ g_errorCode = MULTIPR_APP_WRONG_NUMBER_OF_ARGUMENTS;
+ }
+ else
+ {
+ g_usage = MULTIPR_USAGE_PARTITION2;
+ g_medFilename = argv[2];
+ g_partName = argv[3];
+ g_nbParts = atoi(argv[4]);
+
+ if (argc == 6)
+ {
+ g_splitter = atoi(argv[5]);
+ }
+ }
+ }
+ else if (strcmp(argv[1],"--decim") == 0)
+ {
+ if ((argc != 10) && (argc != 11))
+ {
+ g_usage = MULTIPR_USAGE_UNKNOWN;
+ g_errorCode = MULTIPR_APP_WRONG_NUMBER_OF_ARGUMENTS;
+ }
+ else
+ {
+ g_usage = MULTIPR_USAGE_DECIMATION;
+ g_medFilename = argv[2];
+ g_partName = argv[3];
+ g_fieldName = argv[4];
+ g_fieldTimeStepIt = atoi(argv[5]);
+ g_filterName = argv[6];
+ g_decimThresholdMed = atof(argv[7]);
+ g_decimThresholdLow = atof(argv[8]);
+ g_decimRadius = atof(argv[9]);
+
+ if (argc == 11)
+ {
+ g_boxing = atoi(argv[10]);
+ }
+ }
+ }
+ else if (strcmp(argv[1],"--info") == 0)
+ {
+ if ((argc != 3) && (argc != 4))
+ {
+ g_usage = MULTIPR_USAGE_UNKNOWN;
+ g_errorCode = MULTIPR_APP_WRONG_NUMBER_OF_ARGUMENTS;
+ }
+ else
+ {
+ g_usage = MULTIPR_USAGE_INFO;
+ g_medFilename = argv[2];
+
+ if (argc == 4)
+ {
+ g_meshName = argv[3];
+ }
+ }
+ }
+ else
+ {
+ g_usage = MULTIPR_USAGE_UNKNOWN;
+ g_errorCode = MULTIPR_APP_UNKNOWN_USAGE;
+ }
}
*/
int runAutotest()
{
- cout << "Start autotest..." << endl;
-
- int ret = MULTIPR_APP_OK;
- try
- {
- string strMEDfilename = g_medFilename;
- strMEDfilename += "/agregat100grains_12pas.med";
-
- cout << "Test file: " << strMEDfilename << endl << endl;
-
- //---------------------------------------------------------------------
- // Test partionneDomaine() = extract groups from a sequential MED file
- //---------------------------------------------------------------------
- multipr::partitionneDomaine(strMEDfilename.c_str(), "MAIL");
-
- //---------------------------------------------------------------------
- // Test partitionneGrain() = split a group from a distributed MED file
- // using MEDSPLITTER (METIS)
- //---------------------------------------------------------------------
- string strDistributedMEDfilename = g_medFilename;
- strDistributedMEDfilename += "/agregat100grains_12pas_grains_maitre.med";
-
- multipr::partitionneGrain(
- strDistributedMEDfilename.c_str(),
- "MAIL_1",
- 4,
- multipr::MULTIPR_SCOTCH);
-
- multipr::partitionneGrain(
- strDistributedMEDfilename.c_str(),
- "MAIL_97",
- 3,
- multipr::MULTIPR_METIS);
-
- //---------------------------------------------------------------------
- // Test decimePartition() = generate 2 lower resolution of a mesh
- // using decimation based on gradient
- //---------------------------------------------------------------------
- multipr::decimePartition(
- strDistributedMEDfilename.c_str(),
- "MAIL_98",
- "SIG_____SIEF_ELGA_______________",
- 12,
- "Filtre_GradientMoyen",
- 10.0,
- 25.0,
- 0.3,
- 100);
-
- multipr::decimePartition(
- strDistributedMEDfilename.c_str(),
- "MAIL_92",
- "SIG_____SIEF_ELGA_______________",
- 11,
- "Filtre_GradientMoyen",
- 10.0,
- 25.0,
- 0.5,
- 10);
-
- multipr::decimePartition(
- strDistributedMEDfilename.c_str(),
- "MAIL_97_2",
- "SIG_____SIEF_ELGA_______________",
- 10,
- "Filtre_GradientMoyen",
- 10.0,
- 25.0,
- 0.4,
- 20);
-
- //---------------------------------------------------------------------
- // Test passed: OK!
- //---------------------------------------------------------------------
- cout << endl;
- cout << "Test passed: everything seems to be OK" << endl;
- cout << "OK" << endl << endl;
-
- }
- catch (multipr::RuntimeException& e)
- {
- e.dump(cout);
- cout << endl;
- cout << "Test failed" << endl;
- cout << "Failure" << endl << endl;
- ret = MULTIPR_APP_FAILED;
- }
-
- return ret;
+ cout << "Start autotest..." << endl;
+
+ int ret = MULTIPR_APP_OK;
+ try
+ {
+ string strMEDfilename = g_medFilename;
+ strMEDfilename += "/agregat100grains_12pas.med";
+
+ cout << "Test file: " << strMEDfilename << endl << endl;
+
+ //---------------------------------------------------------------------
+ // Test partionneDomaine() = extract groups from a sequential MED file
+ //---------------------------------------------------------------------
+ multipr::partitionneDomaine(strMEDfilename.c_str(), "MAIL");
+
+ //---------------------------------------------------------------------
+ // Test partitionneGrain() = split a group from a distributed MED file
+ // using MEDSPLITTER (METIS)
+ //---------------------------------------------------------------------
+ string strDistributedMEDfilename = g_medFilename;
+ strDistributedMEDfilename += "/agregat100grains_12pas_grains_maitre.med";
+
+ multipr::partitionneGrain(
+ strDistributedMEDfilename.c_str(),
+ "MAIL_1",
+ 4,
+ multipr::MULTIPR_SCOTCH);
+
+ multipr::partitionneGrain(
+ strDistributedMEDfilename.c_str(),
+ "MAIL_97",
+ 3,
+ multipr::MULTIPR_METIS);
+
+ //---------------------------------------------------------------------
+ // Test decimePartition() = generate 2 lower resolution of a mesh
+ // using decimation based on gradient
+ //---------------------------------------------------------------------
+ multipr::decimePartition(
+ strDistributedMEDfilename.c_str(),
+ "MAIL_98",
+ "SIG_____SIEF_ELGA_______________",
+ 12,
+ "Filtre_GradientMoyen",
+ 10.0,
+ 25.0,
+ 0.3,
+ 100);
+
+ multipr::decimePartition(
+ strDistributedMEDfilename.c_str(),
+ "MAIL_92",
+ "SIG_____SIEF_ELGA_______________",
+ 11,
+ "Filtre_GradientMoyen",
+ 10.0,
+ 25.0,
+ 0.5,
+ 10);
+
+ multipr::decimePartition(
+ strDistributedMEDfilename.c_str(),
+ "MAIL_97_2",
+ "SIG_____SIEF_ELGA_______________",
+ 10,
+ "Filtre_GradientMoyen",
+ 10.0,
+ 25.0,
+ 0.4,
+ 20);
+
+ //---------------------------------------------------------------------
+ // Test passed: OK!
+ //---------------------------------------------------------------------
+ cout << endl;
+ cout << "Test passed: everything seems to be OK" << endl;
+ cout << "OK" << endl << endl;
+
+ }
+ catch (multipr::RuntimeException& e)
+ {
+ e.dump(cout);
+ cout << endl;
+ cout << "Test failed" << endl;
+ cout << "Failure" << endl << endl;
+ ret = MULTIPR_APP_FAILED;
+ }
+
+ return ret;
}
*/
int runPartition1()
{
- int ret = MULTIPR_APP_OK;
- try
- {
- multipr::partitionneDomaine(g_medFilename, g_meshName);
- }
- catch (multipr::RuntimeException& e)
- {
- e.dump(cout);
- ret = MULTIPR_APP_FAILED;
- }
-
- return ret;
+ int ret = MULTIPR_APP_OK;
+ try
+ {
+ multipr::partitionneDomaine(g_medFilename, g_meshName);
+ }
+ catch (multipr::RuntimeException& e)
+ {
+ e.dump(cout);
+ ret = MULTIPR_APP_FAILED;
+ }
+
+ return ret;
}
* \return MULTIPR_APP_OK if successful, MULTIPR_APP_FAILED if failure.
*/
int runPartition2()
-{
- int ret = MULTIPR_APP_OK;
- try
- {
- multipr::partitionneGrain(
- g_medFilename,
- g_partName,
- g_nbParts,
- g_splitter);
- }
- catch (multipr::RuntimeException& e)
- {
- e.dump(cout);
- ret = MULTIPR_APP_FAILED;
- }
-
- return ret;
+{
+ int ret = MULTIPR_APP_OK;
+ try
+ {
+ multipr::partitionneGrain(
+ g_medFilename,
+ g_partName,
+ g_nbParts,
+ g_splitter);
+ }
+ catch (multipr::RuntimeException& e)
+ {
+ e.dump(cout);
+ ret = MULTIPR_APP_FAILED;
+ }
+
+ return ret;
}
* \return MULTIPR_APP_OK if successful, MULTIPR_APP_FAILED if failure.
*/
int runDecimation()
-{
- int ret = MULTIPR_APP_OK;
- try
- {
- multipr::decimePartition(
- g_medFilename,
- g_partName,
- g_fieldName,
- g_fieldTimeStepIt,
- g_filterName,
- g_decimThresholdMed,
- g_decimThresholdLow,
- g_decimRadius,
- g_boxing);
- }
- catch (multipr::RuntimeException& e)
- {
- e.dump(cout);
- ret = MULTIPR_APP_FAILED;
- }
-
- return ret;
+{
+ int ret = MULTIPR_APP_OK;
+ try
+ {
+ multipr::decimePartition(
+ g_medFilename,
+ g_partName,
+ g_fieldName,
+ g_fieldTimeStepIt,
+ g_filterName,
+ g_decimThresholdMed,
+ g_decimThresholdLow,
+ g_decimRadius,
+ g_boxing);
+ }
+ catch (multipr::RuntimeException& e)
+ {
+ e.dump(cout);
+ ret = MULTIPR_APP_FAILED;
+ }
+
+ return ret;
}
int runDumpMED()
{
#ifdef MULTIPR_USE_OBJ_API
- int ret = MULTIPR_APP_OK;
- try
- {
- // if mesh is unknown, then list all the meshes in the given MED file
- if (g_meshName == NULL)
- {
- multipr::Obj obj;
- obj.create(g_medFilename);
-
- {
- // display list of meshes contained in the MED file
- vector<string> res = obj.getMeshes();
- cout << "List of meshes in this MED file:" << endl;
- for (unsigned i = 0 ; i < res.size() ; i++)
- {
- cout << "Mesh " << (i + 1) << ": " << res[i] << endl;
- }
- }
-
- cout << endl;
-
- {
- // display list of fields contained in the MED file
- vector<string> names = obj.getFields();
- cout << "List of fields in this MED file:" << endl;
- for (unsigned i = 0 ; i < names.size() ; i++)
- {
- cout << "Field " << (i + 1) << ": " << names[i] << " #it=" << obj.getTimeStamps(names[i].c_str()) << endl;
- }
- }
- }
- else
- {
- // display all infos about one mesh in a MED file
- multipr::Mesh mesh;
- mesh.readSequentialMED(g_medFilename, g_meshName);
- mesh.setPrintAll(true);
- cout << mesh << endl;
- }
- cout << "OK" << endl;
- }
- catch (multipr::RuntimeException& e)
- {
- e.dump(cout);
- ret = MULTIPR_APP_FAILED;
- }
-
- return ret;
+ int ret = MULTIPR_APP_OK;
+ try
+ {
+ // if mesh is unknown, then list all the meshes in the given MED file
+ if (g_meshName == NULL)
+ {
+ multipr::Obj obj;
+ obj.create(g_medFilename);
+
+ {
+ // display list of meshes contained in the MED file
+ vector<string> res = obj.getMeshes();
+ cout << "List of meshes in this MED file:" << endl;
+ for (unsigned i = 0 ; i < res.size() ; i++)
+ {
+ cout << "Mesh " << (i + 1) << ": \"" << res[i] << "\"" << endl;
+ }
+ }
+
+ cout << endl;
+
+ {
+ // display list of fields contained in the MED file
+ vector<string> names = obj.getFields();
+ cout << "List of scalar fields in this MED file:" << endl;
+ for (unsigned i = 0 ; i < names.size() ; i++)
+ {
+ cout << "Field " << (i + 1) << ": \"" << names[i] << "\" #Time stamps=" << obj.getTimeStamps(names[i].c_str()) << endl;
+ }
+ }
+ }
+ else
+ {
+ // display all infos about one mesh in a MED file
+ multipr::Mesh mesh;
+ mesh.readSequentialMED(g_medFilename, g_meshName);
+ mesh.setPrintAll(true);
+ cout << mesh << endl;
+ }
+ cout << "OK" << endl;
+ }
+ catch (multipr::RuntimeException& e)
+ {
+ e.dump(cout);
+ ret = MULTIPR_APP_FAILED;
+ }
+
+ return ret;
#else
- int ret = MULTIPR_APP_OK;
- try
- {
- // if mesh is unknown, then list all the meshes in the given MED file
- if (g_meshName == NULL)
- {
- {
- // display list of meshes contained in the MED file
- vector<string> res = multipr::getListMeshes(g_medFilename);
- cout << "List of meshes in this MED file:" << endl;
- for (unsigned i = 0 ; i < res.size() ; i++)
- {
- cout << "Mesh " << (i + 1) << ": " << res[i] << endl;
- }
- }
-
- cout << endl;
-
- {
- // display list of fields contained in the MED file
- vector<pair<string,int> > res = multipr::getListScalarFields(g_medFilename);
- cout << "List of fields in this MED file:" << endl;
- for (unsigned i = 0 ; i < res.size() ; i++)
- {
- cout << "Field " << (i + 1) << ": " << res[i].first << " #it=" << res[i].second << endl;
- }
- }
- }
- else
- {
- // display all infos about one mesh in a MED file
- multipr::Mesh mesh;
- mesh.readSequentialMED(g_medFilename, g_meshName);
- mesh.setPrintAll(true);
- cout << mesh << endl;
- }
- cout << "OK" << endl;
- }
- catch (multipr::RuntimeException& e)
- {
- e.dump(cout);
- ret = MULTIPR_APP_FAILED;
- }
-
- return ret;
+ int ret = MULTIPR_APP_OK;
+ try
+ {
+ // if mesh is unknown, then list all the meshes in the given MED file
+ if (g_meshName == NULL)
+ {
+ {
+ // display list of meshes contained in the MED file
+ vector<string> res = multipr::getListMeshes(g_medFilename);
+ cout << "List of meshes in this MED file:" << endl;
+ for (unsigned i = 0 ; i < res.size() ; i++)
+ {
+ cout << "Mesh " << (i + 1) << ": \"" << res[i] << "\"" << endl;
+ }
+ }
+
+ cout << endl;
+
+ {
+ // display list of fields contained in the MED file
+ vector<pair<string,int> > res = multipr::getListScalarFields(g_medFilename);
+ cout << "List of scalar fields in this MED file:" << endl;
+ for (unsigned i = 0 ; i < res.size() ; i++)
+ {
+ cout << "Field " << (i + 1) << ": \"" << res[i].first << "\" #Time stamps=" << res[i].second << endl;
+ }
+ }
+ }
+ else
+ {
+ // display all infos about one mesh in a MED file
+ multipr::Mesh mesh;
+ mesh.readSequentialMED(g_medFilename, g_meshName);
+ mesh.setPrintAll(true);
+ cout << mesh << endl;
+ }
+ cout << "OK" << endl;
+ }
+ catch (multipr::RuntimeException& e)
+ {
+ e.dump(cout);
+ ret = MULTIPR_APP_FAILED;
+ }
+
+ return ret;
#endif
}
*/
int run()
{
- printGlobals();
-
- int ret = MULTIPR_APP_OK;
- switch (g_usage)
- {
- case MULTIPR_USAGE_AUTOTEST: ret = runAutotest(); break;
- case MULTIPR_USAGE_PARTITION1: ret = runPartition1(); break;
- case MULTIPR_USAGE_PARTITION2: ret = runPartition2(); break;
- case MULTIPR_USAGE_DECIMATION: ret = runDecimation(); break;
- case MULTIPR_USAGE_INFO: ret = runDumpMED(); break;
- default:
- cout << "ERROR: unknown usage" << endl;
- ret = MULTIPR_APP_FAILED;
- break;
- }
-
- return ret;
+ printGlobals();
+
+ int ret = MULTIPR_APP_OK;
+ switch (g_usage)
+ {
+ case MULTIPR_USAGE_AUTOTEST: ret = runAutotest(); break;
+ case MULTIPR_USAGE_PARTITION1: ret = runPartition1(); break;
+ case MULTIPR_USAGE_PARTITION2: ret = runPartition2(); break;
+ case MULTIPR_USAGE_DECIMATION: ret = runDecimation(); break;
+ case MULTIPR_USAGE_INFO: ret = runDumpMED(); break;
+ default:
+ cout << "ERROR: unknown usage" << endl;
+ ret = MULTIPR_APP_FAILED;
+ break;
+ }
+
+ return ret;
}
*/
int main(int argc, char** argv)
{
- cout << "multipr v" << multipr::getVersion() << " - by EDF/CS - 01/2007" << endl;
- cout << "==================================" << endl;
-
- #ifdef MULTIPR_USE_OBJ_API
- cout << "Version MULTIPR_Obj" << endl;
- #else
- cout << "Version MULTIPR_API" << endl;
- #endif
-
- parseCommandLine(argc, argv);
-
- int ret = MULTIPR_APP_OK; // assume no error at the beginning
-
- if (g_usage == MULTIPR_USAGE_UNKNOWN)
- {
- if (argc != 1)
- {
- // if usage is unknown and there are some arguments, print an error message
- cout << "ERROR: " << getErrorMsg() << endl;
- cout << endl;
- ret = MULTIPR_APP_FAILED;
- }
- else
- {
- // if no argument, print a description of this application
- printDescription();
- }
-
- printUsage();
- }
- else if (g_usage == MULTIPR_USAGE_DISPLAY_HELP)
- {
- printDescription();
- printUsage();
- }
- else
- {
- // the application seems to be configured properly: it can be executed
- ret = run();
- }
-
- return ret;
+ string strTitle = string("multipr v") + string(multipr::getVersion()) + string(" - by EDF/CS - 03/2007");
+ string strUnderline = "";
+
+ for (int i = 0, len = strTitle.length() ; i < len ; i++) strUnderline += '=';
+
+ cout << strTitle << endl;
+ cout << strUnderline << endl;
+
+ #ifdef MULTIPR_USE_OBJ_API
+ cout << "Version MULTIPR_Obj" << endl;
+ #else
+ cout << "Version MULTIPR_API" << endl;
+ #endif
+
+ parseCommandLine(argc, argv);
+
+ int ret = MULTIPR_APP_OK; // assume no error at the beginning
+
+ if (g_usage == MULTIPR_USAGE_UNKNOWN)
+ {
+ if (argc != 1)
+ {
+ // if usage is unknown and there are some arguments, print an error message
+ cout << "ERROR: " << getErrorMsg() << endl;
+ cout << endl;
+ ret = MULTIPR_APP_FAILED;
+ }
+ else
+ {
+ // if no argument, print a description of this application
+ printDescription();
+ }
+
+ printUsage();
+ }
+ else if (g_usage == MULTIPR_USAGE_DISPLAY_HELP)
+ {
+ printDescription();
+ printUsage();
+ }
+ else
+ {
+ // the application seems to be configured properly: it can be executed
+ ret = run();
+ }
+
+ return ret;
}
// EOF