| 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 __CATALYST_EXODUS_MESH_H |
| 8 |
#define __CATALYST_EXODUS_MESH_H |
| 9 |
|
| 10 |
#include "vtkNew.h" |
| 11 |
#include "vtkPartitionedDataSetCollection.h" |
| 12 |
#include <map> |
| 13 |
#include <vector> |
| 14 |
#include <visualization/catalyst/manager/CatalystManager.h> |
| 15 |
#include <visualization/exodus/CatalystExodusMeshBase.h> |
| 16 |
|
| 17 |
class vtkUnstructuredGrid; |
| 18 |
class vtkVariant; |
| 19 |
class vtkPoints; |
| 20 |
|
| 21 |
namespace Iovs_exodus { |
| 22 |
|
| 23 |
class CatalystExodusMesh : public CatalystExodusMeshBase |
| 24 |
{ |
| 25 |
|
| 26 |
using CatalystPipelineInfo = Iovs::CatalystManager::CatalystPipelineInfo; |
| 27 |
|
| 28 |
public: |
| 29 |
CatalystExodusMesh(Iovs::CatalystManager *cm, CatalystPipelineInfo &catalystPipelineInfo); |
| 30 |
|
| 31 |
~CatalystExodusMesh(); |
| 32 |
|
| 33 |
void PerformCoProcessing(std::vector<int> &error_and_warning_codes, |
| 34 |
std::vector<std::string> &error_and_warning_messages); |
| 35 |
|
| 36 |
void SetTimeData(double currentTime, int timeStep); |
| 37 |
|
| 38 |
void logMemoryUsageAndTakeTimerReading(); |
| 39 |
|
| 40 |
void ReleaseMemory(); |
| 41 |
|
| 42 |
void Delete(); |
| 43 |
|
| 44 |
void CreateGlobalVariable(const std::string &variable_name, int num_comps, const double *data); |
| 45 |
|
| 46 |
void CreateGlobalVariable(const std::string &variable_name, int num_comps, const int *data); |
| 47 |
|
| 48 |
void CreateGlobalVariable(const std::string &variable_name, int num_comps, const int64_t *data); |
| 49 |
|
| 50 |
void InitializeGlobalPoints(int num_points, int dimension, const double *data); |
| 51 |
|
| 52 |
void InitializeElementBlocks(const ElementBlockIdNameList &elemBlockNameIdList); |
| 53 |
|
| 54 |
void CreateElementBlock(const char *elem_block_name, int elem_block_id, |
| 55 |
const std::string &elem_type, int nodes_per_elem, int num_elem, |
| 56 |
const int64_t *global_elem_ids, int *connectivity); |
| 57 |
|
| 58 |
void CreateElementBlock(const char *elem_block_name, int elem_block_id, |
| 59 |
const std::string &elem_type, int nodes_per_elem, int num_elem, |
| 60 |
const int64_t *global_elem_ids, int64_t *connectivity); |
| 61 |
|
| 62 |
void CreateElementVariable(const std::string &variable_name, int num_comps, int elem_block_id, |
| 63 |
const double *data); |
| 64 |
|
| 65 |
void CreateElementVariable(const std::string &variable_name, int num_comps, int elem_block_id, |
| 66 |
const int *data); |
| 67 |
|
| 68 |
void CreateElementVariable(const std::string &variable_name, int num_comps, int elem_block_id, |
| 69 |
const int64_t *data); |
| 70 |
|
| 71 |
void CreateNodalVariable(const std::string &variable_name, int num_comps, const double *data); |
| 72 |
|
| 73 |
void CreateNodalVariable(const std::string &variable_name, int num_comps, const int *data); |
| 74 |
|
| 75 |
void CreateNodalVariable(const std::string &variable_name, int num_comps, const int64_t *data); |
| 76 |
|
| 77 |
// Description: |
| 78 |
// If true (the default), vector variables will contain a |
| 79 |
// trailing underscore in their name. The default behavior |
| 80 |
// is consistent with the ParaView Exodus II file reader. |
| 81 |
bool UnderscoreVectorsON(); |
| 82 |
void SetUnderscoreVectors(bool status); |
| 83 |
|
| 84 |
// Description: |
| 85 |
// If true (the default), displacements will be applied to the |
| 86 |
// mesh nodes before being sent to the in-situ pipeline. The node |
| 87 |
// displacement variable is called either DISPL or displ. The |
| 88 |
// default behavior is consistent with the ParaView Exodus II |
| 89 |
// file reader. |
| 90 |
bool ApplyDisplacementsON(); |
| 91 |
void SetApplyDisplacements(bool status); |
| 92 |
|
| 93 |
vtkPartitionedDataSetCollection *getPartitionedDataSetCollection(); |
| 94 |
|
| 95 |
private: |
| 96 |
std::map<int, std::map<int, int>> ebmap; |
| 97 |
std::map<int, std::map<int, int>> ebmap_reverse; |
| 98 |
std::map<int, std::map<int, int>> global_elem_id_map; |
| 99 |
std::vector<int> global_point_id_to_global_elem_id; |
| 100 |
std::map<int, unsigned int> ebidmap; |
| 101 |
double GetArrayValue(vtkVariant &v, const void *data, int index); |
| 102 |
void ReleaseGlobalPoints(); |
| 103 |
vtkPoints *global_points; |
| 104 |
int num_global_points; |
| 105 |
bool writeCatalystMesh; |
| 106 |
std::string catalystMeshFilePrefix; |
| 107 |
|
| 108 |
void CreateElementBlockInternal(const char *elem_block_name, int elem_block_id, |
| 109 |
const std::string &elem_type, int nodes_per_elem, int num_elem, |
| 110 |
vtkVariant &v, const int64_t *global_elem_ids, |
| 111 |
void *connectivity); |
| 112 |
|
| 113 |
void CreateGlobalVariableVariant(const std::string &variable_name, int num_comps, vtkVariant &v, |
| 114 |
const void *data); |
| 115 |
void CreateGlobalVariableInternal(const std::string &variable_name, int num_comps, |
| 116 |
vtkUnstructuredGrid *ug, vtkVariant &v, const void *data); |
| 117 |
|
| 118 |
void CreateNodalVariableVariant(const std::string &variable_name, int num_comps, vtkVariant &v, |
| 119 |
const void *data); |
| 120 |
void CreateNodalVariableInternal(const std::string &variable_name, int num_comps, |
| 121 |
vtkUnstructuredGrid *ug, int element_block_id, |
| 122 |
std::map<int, std::map<int, int>> &point_map, vtkVariant &v, |
| 123 |
const void *data); |
| 124 |
|
| 125 |
void CreateElementVariableVariant(const std::string &variable_name, int num_comps, |
| 126 |
int elem_block_id, vtkVariant &v, const void *data); |
| 127 |
void CreateElementVariableInternal(const std::string &variable_name, int num_comps, |
| 128 |
vtkUnstructuredGrid *ug, vtkVariant &v, const void *data); |
| 129 |
|
| 130 |
void ReleaseMemoryInternal(vtkUnstructuredGrid *ug); |
| 131 |
|
| 132 |
CatalystExodusMesh(); |
| 133 |
CatalystExodusMesh(const CatalystExodusMesh &) = delete; |
| 134 |
CatalystExodusMesh &operator=(const CatalystExodusMesh &) = delete; |
| 135 |
|
| 136 |
vtkNew<vtkPartitionedDataSetCollection> vpdc; |
| 137 |
Iovs::CatalystManager *catManager = nullptr; |
| 138 |
bool UnderscoreVectors; |
| 139 |
bool ApplyDisplacements; |
| 140 |
CatalystPipelineInfo catalystPipelineInfo; |
| 141 |
const std::string ASSEMBLY_LABEL = "label"; |
| 142 |
const std::string ASSEMBLY_ROOT_NAME = "IOSS"; |
| 143 |
const std::string ASSEMBLY_ELEMENT_BLOCKS = "element_blocks"; |
| 144 |
const int PDS_UNSTRUCTURED_GRID_INDEX = 0; |
| 145 |
int getElementBlocksAssemblyNode(); |
| 146 |
vtkUnstructuredGrid *getUnstructuredGrid(int blockId); |
| 147 |
}; |
| 148 |
|
| 149 |
} // namespace Iovs_exodus |
| 150 |
|
| 151 |
#endif // __CATALYST_EXODUS_MESH_H |