GEOSX
VTKMeshGenerator.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2018-2020 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University
7  * Copyright (c) 2018-2020 Total, S.A
8  * Copyright (c) 2019- GEOSX Contributors
9  * All rights reserved
10  *
11  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
12  * ------------------------------------------------------------------------------------------------------------
13  */
14 
19 #ifndef GEOS_MESH_GENERATORS_VTKMESHGENERATOR_HPP
20 #define GEOS_MESH_GENERATORS_VTKMESHGENERATOR_HPP
21 
24 #include "mesh/mpiCommunications/SpatialPartition.hpp"
25 
26 #include <vtkDataSet.h>
27 
28 namespace geos
29 {
30 
36 {
37 public:
38 
44  VTKMeshGenerator( const string & name,
45  Group * const parent );
46 
51  static string catalogName() { return "VTKMesh"; }
52 
90  virtual void fillCellBlockManager( CellBlockManager & cellBlockManager, SpatialPartition & partition ) override;
91 
93  string const & blockName,
94  string const & meshFieldName,
95  bool isMaterialField,
96  dataRepository::WrapperBase & wrapper ) const override;
97 
98  virtual void freeResources() override;
99 
100 private:
101 
103  struct viewKeyStruct
104  {
105  constexpr static char const * regionAttributeString() { return "regionAttribute"; }
106  constexpr static char const * mainBlockNameString() { return "mainBlockName"; }
107  constexpr static char const * faceBlockNamesString() { return "faceBlocks"; }
108  constexpr static char const * nodesetNamesString() { return "nodesetNames"; }
109  constexpr static char const * partitionRefinementString() { return "partitionRefinement"; }
110  constexpr static char const * partitionMethodString() { return "partitionMethod"; }
111  constexpr static char const * useGlobalIdsString() { return "useGlobalIds"; }
112  };
114 
115  void importVolumicFieldOnArray( string const & cellBlockName,
116  string const & meshFieldName,
117  bool isMaterialField,
118  dataRepository::WrapperBase & wrapper ) const;
119 
120  void importSurfacicFieldOnArray( string const & faceBlockName,
121  string const & meshFieldName,
122  dataRepository::WrapperBase & wrapper ) const;
123 
128  // TODO can we use unique_ptr to hold mesh?
129  vtkSmartPointer< vtkDataSet > m_vtkMesh;
130 
132  string m_attributeName;
133 
135  string m_mainBlockName;
136 
138  array1d< string > m_faceBlockNames;
139 
141  std::map< string, vtkSmartPointer< vtkDataSet > > m_faceBlockMeshes;
142 
144  string_array m_nodesetNames;
145 
147  integer m_partitionRefinement = 0;
148 
150  integer m_useGlobalIds = 0;
151 
153  vtk::PartitionMethod m_partitionMethod = vtk::PartitionMethod::parmetis;
154 
156  vtk::CellMapType m_cellMap;
157 };
158 
159 } // namespace geos
160 
161 #endif /* GEOS_MESH_GENERATORS_VTKMESHGENERATOR_HPP */
The CellBlockManager class provides an interface to ObjectManagerBase in order to manage CellBlock da...
Base class for external mesh generators (importers).
Block
Describe which kind of block must be considered.
The VTKMeshGenerator class provides a class implementation of VTK generated meshes.
VTKMeshGenerator(const string &name, Group *const parent)
Main constructor for MeshGenerator base class.
void importFieldOnArray(Block block, string const &blockName, string const &meshFieldName, bool isMaterialField, dataRepository::WrapperBase &wrapper) const override
import field from the mesh on the array accessible via the given wrapper.
virtual void fillCellBlockManager(CellBlockManager &cellBlockManager, SpatialPartition &partition) override
Generate the mesh using the VTK library.
virtual void freeResources() override
Free internal resources associated with mesh/data import.
static string catalogName()
Return the name of the VTKMeshGenerator in object Catalog.
Base class for all wrappers containing common operations.
Definition: WrapperBase.hpp:55
array1d< string > string_array
A 1-dimensional array of geos::string types.
Definition: DataTypes.hpp:432
std::int32_t integer
Signed integer type.
Definition: DataTypes.hpp:122