| 1 |
// Copyright(C) 1999-2021 National Technology & Engineering Solutions |
| 2 |
// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with |
| 3 |
// NTESS, the U.S. Government retains certain rights in this software. |
| 4 |
// |
| 5 |
// See packages/seacas/LICENSE for details |
| 6 |
|
| 7 |
#ifndef Ioss_Application_h |
| 8 |
#define Ioss_Application_h |
| 9 |
|
| 10 |
#include <string> |
| 11 |
#include <vector> |
| 12 |
|
| 13 |
namespace Ioss { |
| 14 |
class Region; |
| 15 |
class PropertyManager; |
| 16 |
} // namespace Ioss |
| 17 |
|
| 18 |
class IossApplication |
| 19 |
{ |
| 20 |
public: |
| 21 |
IossApplication(int argc, char **argv); |
| 22 |
|
| 23 |
IossApplication(); |
| 24 |
|
| 25 |
~IossApplication(); |
| 26 |
|
| 27 |
void runApplication(); |
| 28 |
|
| 29 |
int getApplicationExitCode(); |
| 30 |
|
| 31 |
bool printIOSSRegionReportON(); |
| 32 |
void setPrintIOSSRegionReport(bool status); |
| 33 |
|
| 34 |
bool outputCopyOfInputDatabaseON(); |
| 35 |
void setOutputCopyOfInputDatabase(bool status); |
| 36 |
|
| 37 |
bool outputCatalystMeshOneFileON(); |
| 38 |
void setOutputCatalystMeshOneFile(bool status); |
| 39 |
|
| 40 |
bool outputCatalystMeshFilePerProcON(); |
| 41 |
void setOutputCatalystMeshFilePerProc(bool status); |
| 42 |
|
| 43 |
bool forceCGNSOutputON(); |
| 44 |
void setForceCGNSOutput(bool status); |
| 45 |
|
| 46 |
bool forceExodusOutputON(); |
| 47 |
void setForceExodusOutput(bool status); |
| 48 |
|
| 49 |
bool useIOSSInputDBTypeON(); |
| 50 |
std::string getIOSSInputDBType(); |
| 51 |
void setIOSSInputDBType(const std::string &dbType); |
| 52 |
|
| 53 |
bool usePhactoriInputScriptON(); |
| 54 |
std::string getPhactoriInputScript(); |
| 55 |
void setPhactoriInputScript(const std::string &scriptFilePath); |
| 56 |
|
| 57 |
bool usePhactoriInputJSONON(); |
| 58 |
|
| 59 |
int getNumberOfPhactoriInputJSONs(); |
| 60 |
std::string getPhactoriInputJSON(int ndx); |
| 61 |
void addPhactoriInputJSON(const std::string &jsonFilePath); |
| 62 |
|
| 63 |
bool useParaViewExportedScriptON(); |
| 64 |
std::string getParaViewExportedScript(); |
| 65 |
void setParaViewExportedScript(const std::string &exportedScriptFilePath); |
| 66 |
|
| 67 |
bool useCatalystStartTimeStepON(); |
| 68 |
int getCatalystStartTimeStep(); |
| 69 |
void setCatalystStartTimeStep(int timeStep); |
| 70 |
|
| 71 |
bool useCatalystStopTimeStepON(); |
| 72 |
int getCatalystStopTimeStep(); |
| 73 |
void setCatalystStopTimeStep(int timeStep); |
| 74 |
|
| 75 |
bool sendMultipleGridsToTheSamePipelineON(); |
| 76 |
void setSendMultipleGridsToTheSamePipeline(bool onOffFlag); |
| 77 |
|
| 78 |
std::string &getFileName(int ndx); |
| 79 |
int getNumberOfFileNames(); |
| 80 |
void addFileName(const std::string &name); |
| 81 |
|
| 82 |
void setAdditionalProperties(Ioss::PropertyManager *additionalProperties); |
| 83 |
Ioss::PropertyManager *getAdditionalProperties(); |
| 84 |
|
| 85 |
private: |
| 86 |
int getMyRank(); |
| 87 |
int getNumRanks(); |
| 88 |
bool isRankZero(); |
| 89 |
bool isSerial(); |
| 90 |
bool decomposedMeshExists(int ndx); |
| 91 |
int getNumberOfInputIOSSRegions(); |
| 92 |
Ioss::Region *getInputIOSSRegion(int ndx); |
| 93 |
void copyInputIOSSDatabaseOnRank(); |
| 94 |
void printMessage(const std::string &message); |
| 95 |
void printErrorMessage(const std::string &message); |
| 96 |
void printIOSSRegionReportsForRank(); |
| 97 |
void exitApplicationSuccess(); |
| 98 |
void exitApplicationFailure(); |
| 99 |
void exitApplication(); |
| 100 |
|
| 101 |
void initialize(); |
| 102 |
void SetUpDefaultProperties(Ioss::PropertyManager *outputProperties); |
| 103 |
void addAdditionalProperties(Ioss::PropertyManager *outputProperties); |
| 104 |
void callCatalystIOSSDatabaseOnRank(); |
| 105 |
void callCatalystIOSSDatabaseOnRankOneGrid(); |
| 106 |
void callCatalystIOSSDatabaseOnRankMultiGrid(bool sendAllGridsToOnePipeline); |
| 107 |
void openInputIOSSDatabase(int ndx); |
| 108 |
void openInputIOSSDatabases(); |
| 109 |
void processCommandLine(int argc, char **argv); |
| 110 |
void initializeMPI(int argc, char **argv); |
| 111 |
void initMPIRankAndSize(); |
| 112 |
void finalizeMPI(); |
| 113 |
void printUsageMessage(); |
| 114 |
void checkForOnlyOneCatalystOutputPath(); |
| 115 |
void checkForOnlyOneCatalystOutputType(); |
| 116 |
void getStartStopTimeSteps(int numTimeSteps, int &startTimeStep, int &stopTimeStep); |
| 117 |
std::string getIOSSDatabaseTypeFromFile(int ndx); |
| 118 |
std::string getIOSSDatabaseType(int ndx); |
| 119 |
std::string getCatalystDatabaseType(int ndx); |
| 120 |
std::string getFileSuffix(int ndx); |
| 121 |
std::string getParallelFileName(int ndx); |
| 122 |
std::string getPhactoriDefaultJSON(); |
| 123 |
int myRank; |
| 124 |
int numRanks; |
| 125 |
bool useCatalystStartTimeStep; |
| 126 |
int catalystStartTimeStep; |
| 127 |
bool useCatalystStopTimeStep; |
| 128 |
int catalystStopTimeStep; |
| 129 |
bool printIOSSReport; |
| 130 |
bool copyDatabase; |
| 131 |
bool writeCatalystMeshOneFile; |
| 132 |
bool writeCatalystMeshFilePerProc; |
| 133 |
bool usePhactoriInputScript; |
| 134 |
bool usePhactoriInputJSON; |
| 135 |
bool useParaViewExportedScript; |
| 136 |
bool forceCGNSOutput; |
| 137 |
bool forceExodusOutput; |
| 138 |
bool useIOSSInputDBType; |
| 139 |
bool hasCommandLineArguments; |
| 140 |
int applicationExitCode; |
| 141 |
bool sendMultipleGridsToTheSamePipeline; |
| 142 |
std::string iossInputDBType; |
| 143 |
std::string phactoriInputScriptFilePath; |
| 144 |
std::string phactoriInputJSONFilePath; |
| 145 |
std::string paraViewExportedScriptFilePath; |
| 146 |
std::vector<std::string> fileName; |
| 147 |
std::vector<std::string> phctriInptJSONFilePathList; |
| 148 |
std::string copyOutputDatabaseName = "iossDatabaseCopy"; |
| 149 |
std::string outputCatalystMeshFileName = "iossDatabaseCatalystMesh"; |
| 150 |
std::string iossReportFileName = "IossRegionReport"; |
| 151 |
const std::string applicationName = "ioss2catalyst"; |
| 152 |
std::vector<Ioss::Region *> inputIOSSRegion; |
| 153 |
Ioss::PropertyManager *additionalProperties; |
| 154 |
|
| 155 |
#if defined(__APPLE__) |
| 156 |
const char *CATALYST_PLUGIN_DYNAMIC_LIBRARY = "libcatalystioss.dylib"; |
| 157 |
#else |
| 158 |
const char *CATALYST_PLUGIN_DYNAMIC_LIBRARY = "libcatalystioss.so"; |
| 159 |
#endif |
| 160 |
}; |
| 161 |
|
| 162 |
#endif |