29 #ifndef NEMOSYS_VTKMESH_H_    30 #define NEMOSYS_VTKMESH_H_    32 #include "nemosys_export.h"    35 #include <vtkUnstructuredGrid.h>    39 template <
class TReader>
    42   reader->SetFileName(fileName.c_str());
    44   reader->GetOutput()->Register(reader);
    45   return vtkDataSet::SafeDownCast(reader->GetOutput());
    53     const std::string &fileName);
    56     const std::string &fileName);
    64                             const std::string &line,
    65                             vtkSmartPointer<vtkUnstructuredGrid> dataSet_tmp);
    68                          const std::string &line, 
nemId_t &numPoints,
    69                          vtkSmartPointer<vtkPoints> 
points,
    70                          vtkSmartPointer<vtkUnstructuredGrid> dataSet_tmp);
    73     const std::istream &meshStream, 
const std::string &line, 
nemId_t &numCells,
    74     const std::vector<vtkSmartPointer<vtkIdList>> &vtkCellIds,
    75     vtkSmartPointer<vtkUnstructuredGrid> dataSet_tmp);
    78                        nemId_t numTuple, 
bool pointOrCell, 
bool &hasPointOrCell,
    79                        vtkSmartPointer<vtkUnstructuredGrid> dataSet_tmp);
    83                       vtkSmartPointer<vtkUnstructuredGrid> dataSet_tmp);
    86 template <
class TWriter>
    88                  vtkSmartPointer<vtkDataSet> dataSet) {
    90   Writer->SetFileName(fname.c_str());
    91   Writer->SetInputData(dataSet);
   105   explicit vtkMesh(
const std::string &fname);
   107   vtkMesh(
const std::string &fname1, 
const std::string &fname2);
   109   vtkMesh(vtkSmartPointer<vtkDataSet> dataSet_tmp, 
const std::string &fname);
   114   vtkMesh(
const std::vector<double> &xCrds, 
const std::vector<double> &yCrds,
   115           const std::vector<double> &zCrds,
   116           const std::vector<nemId_t> &elemConn, 
int cellType,
   117           const std::string &newname);
   119   ~vtkMesh()
 override { std::cout << 
"vtkMesh destroyed" << std::endl; }
   124   void read(
const std::string &fname)
 override {}
   126   void merge(vtkSmartPointer<vtkDataSet> dataSet_new);
   130   std::vector<std::vector<double>> 
getVertCrds() 
const override;
   132   std::map<nemId_t, std::vector<double>> 
getCell(
nemId_t id) 
const override;
   142   void inspectEdges(
const std::string &ofname) 
const override;
   151   void report() 
const override;
   153   void write(
const std::string &fname) 
const override;
   159                          const std::vector<std::vector<double>> &
data) 
override;
   161                          const std::vector<double> &
data) 
override;
   164                         const std::vector<std::vector<double>> &data) 
override;
   167                         const std::vector<double> &data) 
override;
   187 #endif  // NEMOSYS_VTKMESH_H_ vtkSmartPointer< vtkUnstructuredGrid > ReadALegacyVTKFile(const std::string &fileName)
 
bool readLegacyVTKHeader(const std::string &line)
 
data_type data
Edge/face with sorted point ids (a, b, c, ...) is located at some index i in data[b], with data[b][i].first == [a, c] (for edges, third point id treated as -1). 
 
virtual void inspectEdges(const std::string &ofname) const =0
get edge lengths of dataSet 
 
virtual void getPointDataArray(const std::string &name, std::vector< double > &data)
get scalar point or cell data array. 
 
virtual void setPointDataArray(const std::string &name, const std::vector< std::vector< double >> &data)
register data to dataSet's point data 
 
void addLegacyVTKData(vtkDataArray *arr, const std::string &type, bool pointOrCell, vtkSmartPointer< vtkUnstructuredGrid > dataSet_tmp)
 
virtual std::vector< double > getCellLengths() const =0
get diameter of circumsphere of each cell 
 
vtkSmartPointer< vtkUnstructuredGrid > ReadDegenerateVTKFile(const std::string &fileName)
 
A brief description of meshBase. 
 
geoMeshBase * New(MeshType meshType)
Create a new mesh object. 
 
virtual void setCellDataArray(const std::string &name, const std::vector< std::vector< double >> &data)
register data to dataSet's cell data 
 
void writeVTFile(const std::string &fname, vtkSmartPointer< vtkDataSet > dataSet)
 
virtual int getCellDataIdx(const std::string &name)
<> 
 
virtual std::vector< std::vector< double > > getCellVec(nemId_t id) const =0
get vector of coords of cell with id 
 
bool readLegacyVTKCells(const std::istream &meshStream, const std::string &line, nemId_t &numCells, const std::vector< vtkSmartPointer< vtkIdList >> &vtkCellIds, vtkSmartPointer< vtkUnstructuredGrid > dataSet_tmp)
 
virtual int getCellType() const =0
get cell type as an integer assumes all elements are the same type 
 
virtual std::vector< nemId_t > getConnectivities() const =0
get connectivities. 
 
virtual void unsetPointDataArray(int arrayID)
delete array with id from dataSet's point data 
 
virtual std::map< nemId_t, std::vector< double > > getCell(nemId_t id) const =0
get cell with id 
 
virtual vtkSmartPointer< vtkDataSet > extractSurface()=0
extract the surface mesh 
 
virtual void write() const
write the mesh to file named after the private var 'filename'. 
 
bool readLegacyVTKPoints(const std::istream &meshStream, const std::string &line, nemId_t &numPoints, vtkSmartPointer< vtkPoints > points, vtkSmartPointer< vtkUnstructuredGrid > dataSet_tmp)
 
void read(const std::string &fname) override
abstract read method reserved for derived classes 
 
bool readLegacyVTKFieldData(const std::istream &meshStream, const std::string &line, vtkSmartPointer< vtkUnstructuredGrid > dataSet_tmp)
 
virtual void unsetCellDataArray(int arrayID)
delete array with id from dataSet's cell data 
 
std::vector< vtkIdType > points
points given by id in .inp file 
 
vtkDataSet * ReadAnXMLOrSTLFile(const std::string &fileName)
 
virtual std::vector< std::vector< double > > getVertCrds() const =0
get 3 vecs with x,y and z coords 
 
virtual std::vector< double > getCellCenter(nemId_t cellID) const =0
get center of a cell 
 
virtual void report() const
generate a report of the mesh 
 
virtual void getCellDataArray(const std::string &name, std::vector< double > &data)
<> 
 
bool readLegacyVTKData(const std::ifstream &meshStream, const std::string &line, nemId_t numTuple, bool pointOrCell, bool &hasPointOrCell, vtkSmartPointer< vtkUnstructuredGrid > dataSet_tmp)
 
void write() const override
write the mesh to file named after the private var 'filename'. 
 
virtual std::vector< double > getPoint(nemId_t id) const =0
get point with id 
 
virtual void unsetFieldDataArray(const std::string &name)
delete array with id from dataSet's field data