| 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_IOVS_UTILS_H |
| 8 |
#define IOSS_IOVS_UTILS_H |
| 9 |
|
| 10 |
#include "iovs_export.h" |
| 11 |
|
| 12 |
#include "CatalystManagerBase.h" |
| 13 |
#include "Ioss_DBUsage.h" |
| 14 |
#include "Ioss_ParallelUtils.h" |
| 15 |
#include "Ioss_PropertyManager.h" |
| 16 |
#include <string> |
| 17 |
|
| 18 |
namespace Iovs { |
| 19 |
|
| 20 |
class IOVS_EXPORT Utils |
| 21 |
{ |
| 22 |
|
| 23 |
public: |
| 24 |
static Utils &getInstance() |
| 25 |
{ |
| 26 |
static Utils instance; |
| 27 |
return instance; |
| 28 |
} |
| 29 |
|
| 30 |
static bool fileExists(const std::string &filepath); |
| 31 |
|
| 32 |
std::string getCatalystPythonDriverPath(); |
| 33 |
|
| 34 |
void checkDbUsage(Ioss::DatabaseUsage db_usage); |
| 35 |
|
| 36 |
struct DatabaseInfo |
| 37 |
{ |
| 38 |
std::string databaseFilename; |
| 39 |
std::string separatorCharacter; |
| 40 |
const Ioss::ParallelUtils *parallelUtils; |
| 41 |
}; |
| 42 |
|
| 43 |
void createDatabaseOutputFile(const DatabaseInfo &dbinfo); |
| 44 |
|
| 45 |
std::unique_ptr<Iovs_exodus::CatalystExodusMeshBase> |
| 46 |
createCatalystExodusMesh(const DatabaseInfo &dbinfo, const Ioss::PropertyManager &props); |
| 47 |
|
| 48 |
std::unique_ptr<Iovs_cgns::CatalystCGNSMeshBase> |
| 49 |
createCatalystCGNSMesh(const DatabaseInfo &dbinfo, const Ioss::PropertyManager &props); |
| 50 |
|
| 51 |
std::string getDatabaseOutputFilePath(const std::string &databaseFilename, |
| 52 |
const Ioss::PropertyManager &properties); |
| 53 |
|
| 54 |
void reportCatalystErrorMessages(const std::vector<int> &error_codes, |
| 55 |
const std::vector<std::string> &error_messages, int myRank); |
| 56 |
|
| 57 |
void writeToCatalystLogFile(const DatabaseInfo &dbinfo, const Ioss::PropertyManager &props); |
| 58 |
|
| 59 |
CatalystManagerBase &getCatalystManager(); |
| 60 |
|
| 61 |
private: |
| 62 |
Utils(); |
| 63 |
~Utils(); |
| 64 |
Utils(const Utils &) = delete; |
| 65 |
Utils &operator=(const Utils &) = delete; |
| 66 |
|
| 67 |
CatalystManagerBase *catalystManager = nullptr; |
| 68 |
|
| 69 |
CatalystManagerBase *createCatalystManagerInstance(); |
| 70 |
void checkCatalystInterfaceAndPluginVersions(); |
| 71 |
|
| 72 |
void initMeshFromIOSSProps(CatalystManagerBase::CatalystMeshInit &cmInit, |
| 73 |
const DatabaseInfo &dbinfo, const Ioss::PropertyManager &props); |
| 74 |
|
| 75 |
std::string getRestartTag(const std::string &databaseFilename); |
| 76 |
|
| 77 |
void broadCastString(std::string &s, const DatabaseInfo &dbinfo); |
| 78 |
|
| 79 |
void broadCastStatusCode(bool &statusCode, const DatabaseInfo &dbinfo); |
| 80 |
|
| 81 |
void loadPluginLibrary(); |
| 82 |
void setPythonPathForParaViewPythonZipFile(std::string ¶viewPythonZipFilePath); |
| 83 |
|
| 84 |
bool getCatalystPluginPath(std::string &catalystPluginPath, std::string &libOSMesaPath); |
| 85 |
|
| 86 |
std::string getSierraInstallDirectory(); |
| 87 |
|
| 88 |
std::string getCatalystAdapterInstallDirectory(); |
| 89 |
|
| 90 |
void *getDlHandle(); |
| 91 |
|
| 92 |
void *dlHandle = nullptr; |
| 93 |
void *dlHandleLibOSMesa = nullptr; |
| 94 |
|
| 95 |
#if defined(__APPLE__) |
| 96 |
const char *CATALYST_PLUGIN_DYNAMIC_LIBRARY = "libcatalystioss.dylib"; |
| 97 |
#else |
| 98 |
const char *CATALYST_PLUGIN_DYNAMIC_LIBRARY = "libcatalystioss.so"; |
| 99 |
#endif |
| 100 |
const char *CATALYST_PLUGIN_PYTHON_MODULE = "PhactoriDriver.py"; |
| 101 |
const char *CATALYST_PLUGIN_PATH = "viz/catalyst/install"; |
| 102 |
const char *CATALYST_FILE_SUFFIX = ".dummy.pv.catalyst.e"; |
| 103 |
const char *CATALYST_OUTPUT_DIRECTORY = "CatalystOutput"; |
| 104 |
const char *CATALYST_INSTALL_LIB_DIR = "/lib/"; |
| 105 |
const char *CATALYST_INSTALL_PHACTORI_DIR = "/phactori/"; |
| 106 |
const char *CATALYST_IOSS_CATALYST_PLUGIN_DIR = "/current_ioss_catalyst_plugin_version"; |
| 107 |
const char *CATALYST_LIB_OSMESA = "libOSMesa.so"; |
| 108 |
const char *CATALYST_LIB_OSMESA_DIR = "/current_paraview_install/lib/"; |
| 109 |
const char *CATALYST_PARAVIEW_PYTHON_ZIP_FILE = |
| 110 |
"/current_paraview_lib_python/site-packages/_paraview.zip"; |
| 111 |
}; |
| 112 |
|
| 113 |
} // namespace Iovs |
| 114 |
|
| 115 |
#endif |