NEMoSys  0.63.0
A modular, extensible resource with robust automated mesh generation, mesh quality analysis, adaptive mesh refinement, and data transfer between arbitrary meshes.
NEM::MSH::geoMeshBase Class Referenceabstract

abstract class to specify geometry and mesh data More...

Detailed Description

geoMeshBase is an abstract class that specifies an interface for geometry and mesh objects.

Definition at line 102 of file geoMeshBase.H.

Classes

struct  GeoMesh
 
struct  SideSet
 

Public Member Functions

 geoMeshBase ()
 Query for conversion from vtk to gmsh. More...
 
 ~geoMeshBase () override
 
virtual void write (const std::string &fileName)=0
 Write mesh to file. More...
 
virtual void report (std::ostream &out) const =0
 Print a report about the mesh. More...
 
virtual void takeGeoMesh (geoMeshBase *otherGeoMesh)
 Take the GeoMesh of another geoMeshBase. More...
 
virtual void reconstructGeo ()
 Construct the geometry from the mesh alone. More...
 
virtual void mergeGeoMesh (geoMeshBase *otherGeoMesh)
 Merge mesh data from a new geoMesh to an existing geoMesh. More...
 
const std::string & getGeoEntArrayName () const
 Get the name of the geometric entities array. More...
 
void setGeoEntArrayName (const std::string &geoEntArrayName)
 Set the name of the geometric entities array. More...
 
double getAngleThreshold () const
 Get the angle threshold used for surface classification. More...
 
void setAngleThreshold (double angleThreshold)
 Set the angle threshold used for surface classification. More...
 
nemId_t getNumberOfPoints () const
 Get the number of points in mesh. More...
 
nemId_t getNumberOfCells () const
 Get the number of cells in mesh. More...
 
void getPoint (nemId_t id, std::array< double, 3 > *x) const
 Get the coordinate of a point. More...
 
std::array< double, 3 > getPoint (nemId_t id) const
 Get the coordinate of a point. More...
 
void getCell (nemId_t cellId, vtkGenericCell *cell) const
 Get cell. More...
 
vtkCell * getCell (nemId_t cellId) const
 Get cell. More...
 
void getCellBounds (nemId_t cellId, std::array< double, 6 > *bounds) const
 Get cell bounds. More...
 
std::array< double, 6 > getCellBounds (nemId_t cellId) const
 Get cell bounds. More...
 
VTKCellType getCellType (nemId_t cellId) const
 Get VTK cell type. More...
 
void getCellPoints (nemId_t cellId, vtkIdList *ptIds) const
 Get list of point ids defining specified cell. More...
 
void getPointCells (nemId_t ptId, vtkIdList *cellIds) const
 Get list of cell ids using specified point. More...
 
void getCellNeighbors (nemId_t cellId, vtkIdList *ptIds, vtkIdList *cellIds) const
 Get list of cells sharing points ptIds excluding cellId. More...
 
int getNumberOfPointDataArrays () const
 Get number of arrays in the point data. More...
 
void getPointDataArrayCopy (const std::string &arrayName, vtkAbstractArray *array, int *arrayIdx=nullptr) const
 Get copy of point data array by name. More...
 
vtkSmartPointer< vtkAbstractArray > getPointDataArrayCopy (const std::string &arrayName, int *arrayIdx=nullptr) const
 Create and return a copy of point data array by name. More...
 
void getPointDataArrayCopy (int arrayIdx, vtkAbstractArray *array) const
 Get copy of point data array by index. More...
 
vtkSmartPointer< vtkAbstractArray > getPointDataArrayCopy (int arrayIdx) const
 Create and return a copy of point data array by index. More...
 
int getNumberOfCellDataArrays () const
 Get number of arrays in the cell data. More...
 
void getCellDataArrayCopy (const std::string &arrayName, vtkAbstractArray *array, int *arrayIdx=nullptr) const
 Get copy of cell data array by name. More...
 
vtkSmartPointer< vtkAbstractArray > getCellDataArrayCopy (const std::string &arrayName, int *arrayIdx=nullptr) const
 Create and return a copy of cell data array by name. More...
 
void getCellDataArrayCopy (int arrayIdx, vtkAbstractArray *array) const
 Get copy of cell data array by index. More...
 
vtkSmartPointer< vtkAbstractArray > getCellDataArrayCopy (int arrayIdx) const
 Create and return a copy of cell data array by index. More...
 
int getNumberOfFieldDataArrays () const
 Get number of arrays in the field data. More...
 
void getFieldDataArrayCopy (const std::string &arrayName, vtkAbstractArray *array, int *arrayIdx=nullptr) const
 Get copy of field data array by name. More...
 
vtkSmartPointer< vtkAbstractArray > getFieldDataArrayCopy (const std::string &arrayName, int *arrayIdx=nullptr) const
 Create and return a copy of field data array by name. More...
 
void getFieldDataArrayCopy (int arrayIdx, vtkAbstractArray *array) const
 Get copy of field data array by index. More...
 
vtkSmartPointer< vtkAbstractArray > getFieldDataArrayCopy (int arrayIdx) const
 Create and return a copy of field data array by index. More...
 

Protected Member Functions

 geoMeshBase (GeoMesh inGeoMesh)
 Construct geoMeshBase from a GeoMesh struct. More...
 
int setPointDataArray (vtkAbstractArray *array)
 Set point data. More...
 
int setCellDataArray (vtkAbstractArray *array)
 Set cell data. More...
 
int setFieldDataArray (vtkAbstractArray *array)
 Set field data. More...
 
void unsetPointDataArray (int arrayIdx)
 Remove point data array by index. More...
 
void unsetPointDataArray (const std::string &arrayName)
 Remove point data array by name. More...
 
void unsetCellDataArray (int arrayIdx)
 Remove cell data array by index. More...
 
void unsetCellDataArray (const std::string &arrayName)
 Remove cell data array by name. More...
 
void unsetFieldDataArray (int arrayIdx)
 Remove field data array by index. More...
 
void unsetFieldDataArray (const std::string &arrayName)
 Remove field data array by name. More...
 
const GeoMeshgetGeoMesh () const
 Get the underlying geometry object. More...
 
void setGeoMesh (const geoMeshBase::GeoMesh &geoMesh)
 Set the underlying geometry object. More...
 

Static Protected Attributes

static constexpr auto GEO_ENT_DEFAULT_NAME = "GeoEnt"
 

Private Member Functions

virtual void resetNative ()=0
 

Private Attributes

GeoMesh _geoMesh
 
double _angleThreshold
 Dihedral angle threshold (in radians) to classify surfaces (Default: 30 degrees) More...
 

Friends

std::ostream & operator<< (std::ostream &os, const geoMeshBase &base)
 

Inherits vtkDataObject.

Inherited by NEM::MSH::exoGeoMesh, NEM::MSH::foamGeoMesh, NEM::MSH::gmshGeoMesh, NEM::MSH::inpGeoMesh, NEM::MSH::oshGeoMesh, NEM::MSH::smeshGeoMesh, and NEM::MSH::vtkGeoMesh.

Constructor & Destructor Documentation

◆ geoMeshBase() [1/2]

NEM::MSH::geoMeshBase::geoMeshBase ( )
Parameters
vtkType
Returns
type given by GMSH_MSH_TYPES enum

Definition at line 77 of file geoMeshBase.C.

References NEM::MSH::New().

geoMeshBase * New(MeshType meshType)
Create a new mesh object.
geoMeshBase()
Query for conversion from vtk to gmsh.
Definition: geoMeshBase.C:77

◆ ~geoMeshBase()

NEM::MSH::geoMeshBase::~geoMeshBase ( )
override

Definition at line 89 of file geoMeshBase.C.

References NEM::MSH::GmshInterface::Finalize().

89  {
90  this->ReferenceCount--;
91 #ifdef HAVE_GMSH
93 #endif
94  std::cout << "geoMeshBase destructed" << std::endl;
95 }
static void Finalize()
Finalize Gmsh.
Definition: geoMeshBase.C:72

◆ geoMeshBase() [2/2]

NEM::MSH::geoMeshBase::geoMeshBase ( GeoMesh  inGeoMesh)
explicitprotected
Parameters
inGeoMesha mesh, geo, link, and sideSet

Definition at line 80 of file geoMeshBase.C.

References NEM::MSH::GmshInterface::Initialize().

81  : _geoMesh(std::move(inGeoMesh)), _angleThreshold(30.0 * M_PI / 180.0) {
82  InitializeObjectBase();
83 #ifdef HAVE_GMSH
85 #endif
86  std::cout << "geoMeshBase constructed" << std::endl;
87 }
static void Initialize()
Initialize Gmsh.
Definition: geoMeshBase.C:67
double _angleThreshold
Dihedral angle threshold (in radians) to classify surfaces (Default: 30 degrees)
Definition: geoMeshBase.H:554

Member Function Documentation

◆ getAngleThreshold()

double NEM::MSH::geoMeshBase::getAngleThreshold ( ) const
inline
Returns
angle threshold (in radians)

Definition at line 171 of file geoMeshBase.H.

171 { return _angleThreshold; }
double _angleThreshold
Dihedral angle threshold (in radians) to classify surfaces (Default: 30 degrees)
Definition: geoMeshBase.H:554

◆ getCell() [1/2]

void NEM::MSH::geoMeshBase::getCell ( nemId_t  cellId,
vtkGenericCell *  cell 
) const
inline
Parameters
cellIdcell id
cellcell

Definition at line 214 of file geoMeshBase.H.

Referenced by NEM::MSH::diffMesh().

214  {
215  _geoMesh.mesh->GetCell(cellId, cell);
216  }
vtkSmartPointer< vtkUnstructuredGrid > mesh
Definition: geoMeshBase.H:419

◆ getCell() [2/2]

vtkCell* NEM::MSH::geoMeshBase::getCell ( nemId_t  cellId) const
inline
Parameters
cellIdcell id
Returns
cell

Definition at line 222 of file geoMeshBase.H.

222  {
223  return _geoMesh.mesh->GetCell(cellId);
224  }
vtkSmartPointer< vtkUnstructuredGrid > mesh
Definition: geoMeshBase.H:419

◆ getCellBounds() [1/2]

void NEM::MSH::geoMeshBase::getCellBounds ( nemId_t  cellId,
std::array< double, 6 > *  bounds 
) const
inline
Parameters
cellIdcell id
boundsarray of bounds as (x_min,x_max, y_min,y_max, z_min,z_max)

Definition at line 230 of file geoMeshBase.H.

230  {
231  _geoMesh.mesh->GetCellBounds(cellId, bounds->data());
232  }
vtkSmartPointer< vtkUnstructuredGrid > mesh
Definition: geoMeshBase.H:419

◆ getCellBounds() [2/2]

std::array<double, 6> NEM::MSH::geoMeshBase::getCellBounds ( nemId_t  cellId) const
inline
Parameters
cellIdcell id
Returns
array of bounds as (x_min,x_max, y_min,y_max, z_min,z_max)

Definition at line 238 of file geoMeshBase.H.

238  {
239  std::array<double, 6> bounds{};
240  getCellBounds(cellId, &bounds);
241  return bounds;
242  }
void getCellBounds(nemId_t cellId, std::array< double, 6 > *bounds) const
Get cell bounds.
Definition: geoMeshBase.H:230

◆ getCellDataArrayCopy() [1/4]

void NEM::MSH::geoMeshBase::getCellDataArrayCopy ( const std::string &  arrayName,
vtkAbstractArray *  array,
int *  arrayIdx = nullptr 
) const

Optionally, get array index.

Parameters
arrayNamearray name
arraycell data array
arrayIdxarray index

Definition at line 180 of file geoMeshBase.C.

References _geoMesh, and NEM::MSH::geoMeshBase::GeoMesh::mesh.

Referenced by NEM::MSH::diffMesh().

182  {
183  getArrCopy(_geoMesh.mesh->GetCellData(), arrayName, arrayIdx, array);
184 }
vtkSmartPointer< vtkUnstructuredGrid > mesh
Definition: geoMeshBase.H:419

◆ getCellDataArrayCopy() [2/4]

vtkSmartPointer< vtkAbstractArray > NEM::MSH::geoMeshBase::getCellDataArrayCopy ( const std::string &  arrayName,
int *  arrayIdx = nullptr 
) const

Optionally, get array index.

Parameters
arrayNamearray name
arrayIdxarray index
Returns
pointer to copy of array

Definition at line 186 of file geoMeshBase.C.

References _geoMesh, and NEM::MSH::geoMeshBase::GeoMesh::mesh.

187  {
188  return getArrCopy(_geoMesh.mesh->GetCellData(), arrayName, arrayIdx);
189 }
vtkSmartPointer< vtkUnstructuredGrid > mesh
Definition: geoMeshBase.H:419

◆ getCellDataArrayCopy() [3/4]

void NEM::MSH::geoMeshBase::getCellDataArrayCopy ( int  arrayIdx,
vtkAbstractArray *  array 
) const
Parameters
arrayIdxarray index
arraycell data array

Definition at line 191 of file geoMeshBase.C.

References _geoMesh, and NEM::MSH::geoMeshBase::GeoMesh::mesh.

192  {
193  getArrCopy(_geoMesh.mesh->GetCellData(), arrayIdx, array);
194 }
vtkSmartPointer< vtkUnstructuredGrid > mesh
Definition: geoMeshBase.H:419

◆ getCellDataArrayCopy() [4/4]

vtkSmartPointer< vtkAbstractArray > NEM::MSH::geoMeshBase::getCellDataArrayCopy ( int  arrayIdx) const
Parameters
arrayIdxarray index
Returns
pointer to copy of array

Definition at line 196 of file geoMeshBase.C.

References _geoMesh, and NEM::MSH::geoMeshBase::GeoMesh::mesh.

197  {
198  return getArrCopy(_geoMesh.mesh->GetCellData(), arrayIdx);
199 }
vtkSmartPointer< vtkUnstructuredGrid > mesh
Definition: geoMeshBase.H:419

◆ getCellNeighbors()

void NEM::MSH::geoMeshBase::getCellNeighbors ( nemId_t  cellId,
vtkIdList *  ptIds,
vtkIdList *  cellIds 
) const
inline
Parameters
cellIdid of cell to exclude
ptIdspoint id
cellIdslist of cell ids

Definition at line 273 of file geoMeshBase.H.

274  {
275  _geoMesh.mesh->GetCellNeighbors(cellId, ptIds, cellIds);
276  }
vtkSmartPointer< vtkUnstructuredGrid > mesh
Definition: geoMeshBase.H:419

◆ getCellPoints()

void NEM::MSH::geoMeshBase::getCellPoints ( nemId_t  cellId,
vtkIdList *  ptIds 
) const
inline
Parameters
cellIdcell id
ptIdslist of point ids

Definition at line 256 of file geoMeshBase.H.

256  {
257  _geoMesh.mesh->GetCellPoints(cellId, ptIds);
258  }
vtkSmartPointer< vtkUnstructuredGrid > mesh
Definition: geoMeshBase.H:419

◆ getCellType()

VTKCellType NEM::MSH::geoMeshBase::getCellType ( nemId_t  cellId) const
inline
Parameters
cellIdcell id
Returns
VTK cell type (see vtk documentation for specifics)

Definition at line 248 of file geoMeshBase.H.

248  {
249  return static_cast<VTKCellType>(_geoMesh.mesh->GetCellType(cellId));
250  }
vtkSmartPointer< vtkUnstructuredGrid > mesh
Definition: geoMeshBase.H:419

◆ getFieldDataArrayCopy() [1/4]

void NEM::MSH::geoMeshBase::getFieldDataArrayCopy ( const std::string &  arrayName,
vtkAbstractArray *  array,
int *  arrayIdx = nullptr 
) const

Optionally, get array index.

Parameters
arrayNamearray name
arrayfield data array
arrayIdxarray index

Definition at line 201 of file geoMeshBase.C.

References _geoMesh, and NEM::MSH::geoMeshBase::GeoMesh::mesh.

203  {
204  getArrCopy(_geoMesh.mesh->GetFieldData(), arrayName, arrayIdx, array);
205 }
vtkSmartPointer< vtkUnstructuredGrid > mesh
Definition: geoMeshBase.H:419

◆ getFieldDataArrayCopy() [2/4]

vtkSmartPointer< vtkAbstractArray > NEM::MSH::geoMeshBase::getFieldDataArrayCopy ( const std::string &  arrayName,
int *  arrayIdx = nullptr 
) const

Optionally, get array index.

Parameters
arrayNamearray name
arrayIdxarray index
Returns
pointer to copy of array

Definition at line 207 of file geoMeshBase.C.

References _geoMesh, and NEM::MSH::geoMeshBase::GeoMesh::mesh.

208  {
209  return getArrCopy(_geoMesh.mesh->GetFieldData(), arrayName, arrayIdx);
210 }
vtkSmartPointer< vtkUnstructuredGrid > mesh
Definition: geoMeshBase.H:419

◆ getFieldDataArrayCopy() [3/4]

void NEM::MSH::geoMeshBase::getFieldDataArrayCopy ( int  arrayIdx,
vtkAbstractArray *  array 
) const
Parameters
arrayIdxarray index
arrayfield data array

Definition at line 212 of file geoMeshBase.C.

References _geoMesh, and NEM::MSH::geoMeshBase::GeoMesh::mesh.

213  {
214  getArrCopy(_geoMesh.mesh->GetFieldData(), arrayIdx, array);
215 }
vtkSmartPointer< vtkUnstructuredGrid > mesh
Definition: geoMeshBase.H:419

◆ getFieldDataArrayCopy() [4/4]

vtkSmartPointer< vtkAbstractArray > NEM::MSH::geoMeshBase::getFieldDataArrayCopy ( int  arrayIdx) const
Parameters
arrayIdxarray index
Returns
pointer to copy of array

Definition at line 217 of file geoMeshBase.C.

References _geoMesh, and NEM::MSH::geoMeshBase::GeoMesh::mesh.

218  {
219  return getArrCopy(_geoMesh.mesh->GetFieldData(), arrayIdx);
220 }
vtkSmartPointer< vtkUnstructuredGrid > mesh
Definition: geoMeshBase.H:419

◆ getGeoEntArrayName()

const std::string& NEM::MSH::geoMeshBase::getGeoEntArrayName ( ) const
inline
Returns
name of geometric entities array

Definition at line 157 of file geoMeshBase.H.

Referenced by NEM::MSH::diffMesh().

157 { return _geoMesh.link; }

◆ getGeoMesh()

◆ getNumberOfCellDataArrays()

int NEM::MSH::geoMeshBase::getNumberOfCellDataArrays ( ) const
inline
Returns
number of arrays in the cell data

Definition at line 318 of file geoMeshBase.H.

Referenced by NEM::MSH::diffMesh().

318  {
319  return _geoMesh.mesh->GetCellData()->GetNumberOfArrays();
320  }
vtkSmartPointer< vtkUnstructuredGrid > mesh
Definition: geoMeshBase.H:419

◆ getNumberOfCells()

nemId_t NEM::MSH::geoMeshBase::getNumberOfCells ( ) const
inline
Returns
number of cells in mesh

Definition at line 190 of file geoMeshBase.H.

Referenced by NEM::MSH::diffMesh().

190 { return _geoMesh.mesh->GetNumberOfCells(); }
vtkSmartPointer< vtkUnstructuredGrid > mesh
Definition: geoMeshBase.H:419

◆ getNumberOfFieldDataArrays()

int NEM::MSH::geoMeshBase::getNumberOfFieldDataArrays ( ) const
inline
Returns
number of arrays in the field data

Definition at line 355 of file geoMeshBase.H.

355  {
356  return _geoMesh.mesh->GetFieldData()->GetNumberOfArrays();
357  }
vtkSmartPointer< vtkUnstructuredGrid > mesh
Definition: geoMeshBase.H:419

◆ getNumberOfPointDataArrays()

int NEM::MSH::geoMeshBase::getNumberOfPointDataArrays ( ) const
inline
Returns
number of arrays in the point data

Definition at line 281 of file geoMeshBase.H.

Referenced by NEM::MSH::diffMesh().

281  {
282  return _geoMesh.mesh->GetPointData()->GetNumberOfArrays();
283  }
vtkSmartPointer< vtkUnstructuredGrid > mesh
Definition: geoMeshBase.H:419

◆ getNumberOfPoints()

nemId_t NEM::MSH::geoMeshBase::getNumberOfPoints ( ) const
inline
Returns
number of points in mesh

Definition at line 183 of file geoMeshBase.H.

Referenced by NEM::MSH::diffMesh().

183  {
184  return _geoMesh.mesh->GetNumberOfPoints();
185  }
vtkSmartPointer< vtkUnstructuredGrid > mesh
Definition: geoMeshBase.H:419

◆ getPoint() [1/2]

void NEM::MSH::geoMeshBase::getPoint ( nemId_t  id,
std::array< double, 3 > *  x 
) const
inline
Parameters
idpoint id
xarray of coordinates as (x,y,z)

Definition at line 196 of file geoMeshBase.H.

Referenced by NEM::MSH::diffMesh().

196  {
197  _geoMesh.mesh->GetPoint(id, x->data());
198  }
vtkSmartPointer< vtkUnstructuredGrid > mesh
Definition: geoMeshBase.H:419

◆ getPoint() [2/2]

std::array<double, 3> NEM::MSH::geoMeshBase::getPoint ( nemId_t  id) const
inline
Parameters
idpoint id
Returns
array of coordinates as (x,y,z)

Definition at line 204 of file geoMeshBase.H.

204  {
205  std::array<double, 3> x{};
206  getPoint(id, &x);
207  return x;
208  }
void getPoint(nemId_t id, std::array< double, 3 > *x) const
Get the coordinate of a point.
Definition: geoMeshBase.H:196

◆ getPointCells()

void NEM::MSH::geoMeshBase::getPointCells ( nemId_t  ptId,
vtkIdList *  cellIds 
) const
inline
Parameters
ptIdpoint id
cellIdslist of cell ids

Definition at line 264 of file geoMeshBase.H.

264  {
265  _geoMesh.mesh->GetPointCells(ptId, cellIds);
266  }
vtkSmartPointer< vtkUnstructuredGrid > mesh
Definition: geoMeshBase.H:419

◆ getPointDataArrayCopy() [1/4]

void NEM::MSH::geoMeshBase::getPointDataArrayCopy ( const std::string &  arrayName,
vtkAbstractArray *  array,
int *  arrayIdx = nullptr 
) const

Optionally, get array index.

Parameters
arrayNamearray name
arraypoint data array
arrayIdxarray index

Definition at line 159 of file geoMeshBase.C.

References _geoMesh, and NEM::MSH::geoMeshBase::GeoMesh::mesh.

Referenced by NEM::MSH::diffMesh().

161  {
162  getArrCopy(_geoMesh.mesh->GetPointData(), arrayName, arrayIdx, array);
163 }
vtkSmartPointer< vtkUnstructuredGrid > mesh
Definition: geoMeshBase.H:419

◆ getPointDataArrayCopy() [2/4]

vtkSmartPointer< vtkAbstractArray > NEM::MSH::geoMeshBase::getPointDataArrayCopy ( const std::string &  arrayName,
int *  arrayIdx = nullptr 
) const

Optionally, get array index.

Parameters
arrayNamearray name
arrayIdxarray index
Returns
pointer to copy of array

Definition at line 165 of file geoMeshBase.C.

References _geoMesh, and NEM::MSH::geoMeshBase::GeoMesh::mesh.

166  {
167  return getArrCopy(_geoMesh.mesh->GetPointData(), arrayName, arrayIdx);
168 }
vtkSmartPointer< vtkUnstructuredGrid > mesh
Definition: geoMeshBase.H:419

◆ getPointDataArrayCopy() [3/4]

void NEM::MSH::geoMeshBase::getPointDataArrayCopy ( int  arrayIdx,
vtkAbstractArray *  array 
) const
Parameters
arrayIdxarray index
arraypoint data array

Definition at line 170 of file geoMeshBase.C.

References _geoMesh, and NEM::MSH::geoMeshBase::GeoMesh::mesh.

171  {
172  getArrCopy(_geoMesh.mesh->GetPointData(), arrayIdx, array);
173 }
vtkSmartPointer< vtkUnstructuredGrid > mesh
Definition: geoMeshBase.H:419

◆ getPointDataArrayCopy() [4/4]

vtkSmartPointer< vtkAbstractArray > NEM::MSH::geoMeshBase::getPointDataArrayCopy ( int  arrayIdx) const
Parameters
arrayIdxarray index
Returns
pointer to copy of array

Definition at line 175 of file geoMeshBase.C.

References _geoMesh, and NEM::MSH::geoMeshBase::GeoMesh::mesh.

176  {
177  return getArrCopy(_geoMesh.mesh->GetPointData(), arrayIdx);
178 }
vtkSmartPointer< vtkUnstructuredGrid > mesh
Definition: geoMeshBase.H:419

◆ mergeGeoMesh()

void NEM::MSH::geoMeshBase::mergeGeoMesh ( geoMeshBase otherGeoMesh)
virtual

Deletes the data from the new geoMesh pointer

Parameters
otherGeoMeshA new geoMesh data to merge

Definition at line 113 of file geoMeshBase.C.

References _geoMesh, NEM::MSH::geoMeshBase::GeoMesh::mesh, NEM::MSH::New(), and resetNative().

113  {
114  vtkSmartPointer<vtkAppendFilter> appendFilter =
116  appendFilter->AddInputData(_geoMesh.mesh);
117  appendFilter->AddInputData(otherGeoMesh->_geoMesh.mesh);
118  appendFilter->MergePointsOn();
119  appendFilter->Update();
120  _geoMesh.mesh = appendFilter->GetOutput();
121  otherGeoMesh->_geoMesh = {
123  otherGeoMesh->resetNative();
124 }
vtkSmartPointer< vtkUnstructuredGrid > mesh
Definition: geoMeshBase.H:419
geoMeshBase * New(MeshType meshType)
Create a new mesh object.
virtual void resetNative()=0

◆ reconstructGeo()

void NEM::MSH::geoMeshBase::reconstructGeo ( )
virtual

Sets geometry, link, and side set. Does not alter the mesh.

Reimplemented in NEM::MSH::exoGeoMesh, NEM::MSH::oshGeoMesh, and NEM::MSH::inpGeoMesh.

Definition at line 466 of file geoMeshBaseReconstructGeo.C.

References _angleThreshold, _geoMesh, NEM::MSH::geoMeshBase::GeoMesh::geo, GEO_ENT_DEFAULT_NAME, nemAux::getRandomString(), NEM::MSH::geoMeshBase::GeoMesh::link, NEM::MSH::geoMeshBase::GeoMesh::mesh, NEM::MSH::geoMeshBase::SideSet::sides, and NEM::MSH::geoMeshBase::GeoMesh::sideSet.

Referenced by NEM::MSH::inpGeoMesh::reconstructGeo(), NEM::MSH::oshGeoMesh::reconstructGeo(), and NEM::MSH::exoGeoMesh::reconstructGeo().

466  {
467 #ifdef HAVE_GMSH
468  if (_geoMesh.geo.empty()) {
469  _geoMesh.geo = "geoMesh_" + nemAux::getRandomString(6);
470  } else {
471  gmsh::model::setCurrent(_geoMesh.geo);
472  gmsh::model::remove();
473  }
474  gmsh::model::add(_geoMesh.geo);
475  gmsh::model::setCurrent(_geoMesh.geo);
476 #endif
477  if (_geoMesh.link.empty()) {
479  }
480  _geoMesh.sideSet = SideSet{
481  computeDiscreteGeoFromMsh(_geoMesh.mesh, _geoMesh.link, _angleThreshold)};
482  assert(_geoMesh.mesh->GetPoints() == _geoMesh.sideSet.sides->GetPoints());
483 }
vtkSmartPointer< vtkUnstructuredGrid > mesh
Definition: geoMeshBase.H:419
static constexpr auto GEO_ENT_DEFAULT_NAME
Definition: geoMeshBase.H:446
std::string getRandomString(int length)
vtkSmartPointer< vtkPolyData > sides
Cells represent edges/faces of some GeoMesh.
Definition: geoMeshBase.H:399
double _angleThreshold
Dihedral angle threshold (in radians) to classify surfaces (Default: 30 degrees)
Definition: geoMeshBase.H:554

◆ report()

void NEM::MSH::geoMeshBase::report ( std::ostream &  out) const
pure virtual
Parameters
outstream

Implemented in NEM::MSH::oshGeoMesh, NEM::MSH::exoGeoMesh, NEM::MSH::foamGeoMesh, NEM::MSH::gmshGeoMesh, and NEM::MSH::vtkGeoMesh.

Definition at line 97 of file geoMeshBase.C.

References getGeoMesh(), mesh, and NEM::MSH::geoMeshBase::GeoMesh::mesh.

Referenced by NEM::MSH::inpGeoMesh::inpGeoMesh(), NEM::MSH::mesh_(), NEM::MSH::gmshGeoMesh::report(), NEM::MSH::vtkGeoMesh::report(), NEM::MSH::foamGeoMesh::report(), NEM::MSH::exoGeoMesh::report(), and NEM::MSH::oshGeoMesh::report().

97  {
98  out << this->GetClassName() << ":\n";
99  auto mesh = getGeoMesh().mesh;
100  out << "Nodes:\t" << mesh->GetNumberOfPoints() << '\n';
101  out << "Elements:\t" << mesh->GetNumberOfCells() << '\n';
102 }
vtkSmartPointer< vtkUnstructuredGrid > mesh
Definition: geoMeshBase.H:419
std::shared_ptr< meshBase > mesh
const GeoMesh & getGeoMesh() const
Get the underlying geometry object.
Definition: geoMeshBase.H:533

◆ resetNative()

virtual void NEM::MSH::geoMeshBase::resetNative ( )
privatepure virtual

◆ setAngleThreshold()

void NEM::MSH::geoMeshBase::setAngleThreshold ( double  angleThreshold)
inline
Parameters
angleThreshold(in radians)

Definition at line 176 of file geoMeshBase.H.

176  {
177  _angleThreshold = angleThreshold;
178  }
double _angleThreshold
Dihedral angle threshold (in radians) to classify surfaces (Default: 30 degrees)
Definition: geoMeshBase.H:554

◆ setCellDataArray()

int NEM::MSH::geoMeshBase::setCellDataArray ( vtkAbstractArray *  array)
inlineprotected
Parameters
arrayarray pointer
Returns
array index

Definition at line 473 of file geoMeshBase.H.

473  {
474  return _geoMesh.mesh->GetCellData()->AddArray(array);
475  }
vtkSmartPointer< vtkUnstructuredGrid > mesh
Definition: geoMeshBase.H:419

◆ setFieldDataArray()

int NEM::MSH::geoMeshBase::setFieldDataArray ( vtkAbstractArray *  array)
inlineprotected
Parameters
arrayarray pointer
Returns
array index

Definition at line 481 of file geoMeshBase.H.

481  {
482  return _geoMesh.mesh->GetFieldData()->AddArray(array);
483  }
vtkSmartPointer< vtkUnstructuredGrid > mesh
Definition: geoMeshBase.H:419

◆ setGeoEntArrayName()

void NEM::MSH::geoMeshBase::setGeoEntArrayName ( const std::string &  geoEntArrayName)
inline
Parameters
geoEntArrayNamename of geometric entities array

Definition at line 162 of file geoMeshBase.H.

162  {
163  auto a = _geoMesh.mesh->GetCellData()->GetArray(_geoMesh.link.c_str());
164  if (a) a->SetName(geoEntArrayName.c_str());
165  _geoMesh.link = geoEntArrayName;
166  }
vtkSmartPointer< vtkUnstructuredGrid > mesh
Definition: geoMeshBase.H:419

◆ setGeoMesh()

void NEM::MSH::geoMeshBase::setGeoMesh ( const geoMeshBase::GeoMesh geoMesh)
inlineprotected

◆ setPointDataArray()

int NEM::MSH::geoMeshBase::setPointDataArray ( vtkAbstractArray *  array)
inlineprotected
Parameters
arrayarray pointer
Returns
array index

Definition at line 465 of file geoMeshBase.H.

465  {
466  return _geoMesh.mesh->GetPointData()->AddArray(array);
467  }
vtkSmartPointer< vtkUnstructuredGrid > mesh
Definition: geoMeshBase.H:419

◆ takeGeoMesh()

void NEM::MSH::geoMeshBase::takeGeoMesh ( geoMeshBase otherGeoMesh)
virtual

Note that otherGeoMesh will be left with an empty mesh.

Parameters
otherGeoMeshother geoMeshBase object; mesh will be left empty

Reimplemented in NEM::MSH::exoGeoMesh, and NEM::MSH::oshGeoMesh.

Definition at line 104 of file geoMeshBase.C.

References _geoMesh, NEM::MSH::New(), and resetNative().

Referenced by NEM::MSH::oshGeoMesh::takeGeoMesh(), and NEM::MSH::exoGeoMesh::takeGeoMesh().

104  {
105  _geoMesh = std::move(otherGeoMesh->_geoMesh);
106  otherGeoMesh->_geoMesh = {
108  otherGeoMesh->resetNative();
109  resetNative();
110 }
geoMeshBase * New(MeshType meshType)
Create a new mesh object.
virtual void resetNative()=0

◆ unsetCellDataArray() [1/2]

void NEM::MSH::geoMeshBase::unsetCellDataArray ( int  arrayIdx)
inlineprotected
Parameters
arrayIdxarray index

Definition at line 503 of file geoMeshBase.H.

503  {
504  _geoMesh.mesh->GetCellData()->RemoveArray(arrayIdx);
505  }
vtkSmartPointer< vtkUnstructuredGrid > mesh
Definition: geoMeshBase.H:419

◆ unsetCellDataArray() [2/2]

void NEM::MSH::geoMeshBase::unsetCellDataArray ( const std::string &  arrayName)
inlineprotected
Parameters
arrayNamearray name

Definition at line 510 of file geoMeshBase.H.

510  {
511  _geoMesh.mesh->GetCellData()->RemoveArray(arrayName.c_str());
512  }
vtkSmartPointer< vtkUnstructuredGrid > mesh
Definition: geoMeshBase.H:419

◆ unsetFieldDataArray() [1/2]

void NEM::MSH::geoMeshBase::unsetFieldDataArray ( int  arrayIdx)
inlineprotected
Parameters
arrayIdxarray index

Definition at line 517 of file geoMeshBase.H.

517  {
518  _geoMesh.mesh->GetFieldData()->RemoveArray(arrayIdx);
519  }
vtkSmartPointer< vtkUnstructuredGrid > mesh
Definition: geoMeshBase.H:419

◆ unsetFieldDataArray() [2/2]

void NEM::MSH::geoMeshBase::unsetFieldDataArray ( const std::string &  arrayName)
inlineprotected
Parameters
arrayNamearray name

Definition at line 524 of file geoMeshBase.H.

524  {
525  _geoMesh.mesh->GetFieldData()->RemoveArray(arrayName.c_str());
526  }
vtkSmartPointer< vtkUnstructuredGrid > mesh
Definition: geoMeshBase.H:419

◆ unsetPointDataArray() [1/2]

void NEM::MSH::geoMeshBase::unsetPointDataArray ( int  arrayIdx)
inlineprotected
Parameters
arrayIdxarray index

Definition at line 489 of file geoMeshBase.H.

489  {
490  _geoMesh.mesh->GetPointData()->RemoveArray(arrayIdx);
491  }
vtkSmartPointer< vtkUnstructuredGrid > mesh
Definition: geoMeshBase.H:419

◆ unsetPointDataArray() [2/2]

void NEM::MSH::geoMeshBase::unsetPointDataArray ( const std::string &  arrayName)
inlineprotected
Parameters
arrayNamearray name

Definition at line 496 of file geoMeshBase.H.

496  {
497  _geoMesh.mesh->GetPointData()->RemoveArray(arrayName.c_str());
498  }
vtkSmartPointer< vtkUnstructuredGrid > mesh
Definition: geoMeshBase.H:419

◆ write()

virtual void NEM::MSH::geoMeshBase::write ( const std::string &  fileName)
pure virtual

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const geoMeshBase base 
)
friend

Definition at line 129 of file geoMeshBase.H.

129  {
130  base.report(os);
131  return os;
132  }

Member Data Documentation

◆ _angleThreshold

double NEM::MSH::geoMeshBase::_angleThreshold
private

Definition at line 554 of file geoMeshBase.H.

Referenced by reconstructGeo().

◆ _geoMesh

GeoMesh NEM::MSH::geoMeshBase::_geoMesh
private

◆ GEO_ENT_DEFAULT_NAME

constexpr auto NEM::MSH::geoMeshBase::GEO_ENT_DEFAULT_NAME = "GeoEnt"
staticprotected

The documentation for this class was generated from the following files: