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::SRV::srvBase Class Referenceabstract

abstract class for services acting on geoMeshBase More...

Detailed Description

srvBase is an abstract class specifying the interface for all services acting on a geoMeshBase mesh and geometry object. It derives from the vtkAlgorithm, exposing the vtk robust algorithm pipeline for NEMoSys services.

Definition at line 53 of file srvBase.H.

Public Member Functions

vtkAbstractTypeMacro(srvBase, vtkAlgorithm) public NEM::MSH::geoMeshBaseGetOutput ()
 Get the output GeoMeshBase for a port on this algorithm. More...
 
NEM::MSH::geoMeshBaseGetOutput (int)
 

Protected Member Functions

 srvBase ()
 
 ~srvBase () override
 
virtual int RequestInformation (vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
 
virtual int RequestDataObject (vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
 This is called by the superclass. More...
 
virtual int RequestData (vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)=0
 This is called by the superclass. More...
 
virtual int RequestUpdateExtent (vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
 This is called by the superclass. More...
 

Inherits vtkAlgorithm.

Inherited by NEM::SRV::NucMeshSrv, and NEM::SRV::omegahRefineSrv.

Constructor & Destructor Documentation

◆ srvBase()

NEM::SRV::srvBase::srvBase ( )
protected

Definition at line 64 of file srvBase.C.

64  {
65  std::cout << "srvBase constructed" << std::endl;
66 }

◆ ~srvBase()

NEM::SRV::srvBase::~srvBase ( )
overrideprotected

Definition at line 68 of file srvBase.C.

References RequestData(), RequestDataObject(), RequestInformation(), and RequestUpdateExtent().

68  {
69  std::cout << "srvBase destructed" << std::endl;
70 }

Member Function Documentation

◆ GetOutput() [1/2]

NEM::MSH::geoMeshBase * NEM::SRV::srvBase::GetOutput ( )

Definition at line 104 of file srvBase.C.

104 { return this->GetOutput(0); }
vtkAbstractTypeMacro(srvBase, vtkAlgorithm) public NEM::MSH::geoMeshBase * GetOutput()
Get the output GeoMeshBase for a port on this algorithm.
Definition: srvBase.C:104

◆ GetOutput() [2/2]

NEM::MSH::geoMeshBase * NEM::SRV::srvBase::GetOutput ( int  port)

Definition at line 106 of file srvBase.C.

106  {
107  return NEM::MSH::geoMeshBase::SafeDownCast(this->GetOutputDataObject(port));
108 }

◆ RequestData()

virtual int NEM::SRV::srvBase::RequestData ( vtkInformation *  request,
vtkInformationVector **  inputVector,
vtkInformationVector *  outputVector 
)
protectedpure virtual

This is the method you should override.

Implemented in NEM::SRV::omegahRefineSrv.

Referenced by NEM::SRV::NucMeshSrv::FillOutputPortInformation(), and ~srvBase().

◆ RequestDataObject()

int NEM::SRV::srvBase::RequestDataObject ( vtkInformation *  request,
vtkInformationVector **  inputVector,
vtkInformationVector *  outputVector 
)
protectedvirtual

Definition at line 110 of file srvBase.C.

References NEM::MSH::gmshGeoMesh::New(), NEM::MSH::vtkGeoMesh::New(), NEM::MSH::smeshGeoMesh::New(), NEM::MSH::foamGeoMesh::New(), NEM::MSH::exoGeoMesh::New(), NEM::MSH::inpGeoMesh::New(), and NEM::MSH::oshGeoMesh::New().

Referenced by ~srvBase().

112  {
113  for (int i = 0; i < outputVector->GetNumberOfInformationObjects(); ++i) {
114  auto outInfo = outputVector->GetInformationObject(i);
115  auto outAlgInfo = this->GetOutputPortInformation(i);
116  if (!outAlgInfo->Has(vtkDataObject::DATA_TYPE_NAME())) {
117  return 0;
118  }
119  std::string typeName = outAlgInfo->Get(vtkDataObject::DATA_TYPE_NAME());
120  MSH::geoMeshBase *output = nullptr;
121  if (typeName == "vtkGeoMesh") {
122  output = MSH::vtkGeoMesh::New();
123  } else if (typeName == "gmshGeoMesh") {
124 #ifdef HAVE_GMSH
125  output = MSH::gmshGeoMesh::New();
126 #endif
127  } else if (typeName == "oshGeoMesh") {
128  output = MSH::oshGeoMesh::New();
129  } else if (typeName == "exoGeoMesh") {
130  output = MSH::exoGeoMesh::New();
131  } else if (typeName == "inpGeoMesh") {
132  output = MSH::inpGeoMesh::New();
133  } else if (typeName == "foamGeoMesh") {
134 #ifdef HAVE_CFMSH
135  output = MSH::foamGeoMesh::New();
136 #endif
137  } else if (typeName == "smeshGeoMesh") {
138 #ifdef HAVE_OCC
139  output = MSH::smeshGeoMesh::New();
140 #endif
141  } else if (typeName == "geoMeshBase") {
142  if (i < this->GetNumberOfInputPorts() &&
143  inputVector[i]->GetNumberOfInformationObjects() > 0) {
144  auto inObj = inputVector[i]
145  ->GetInformationObject(0)
146  ->Get(vtkDataObject::DATA_OBJECT());
147  if (inObj) {
148  output = MSH::geoMeshBase::SafeDownCast(inObj->NewInstance());
149  }
150  }
151  }
152  if (!output) {
153  return 0;
154  }
155  outInfo->Set(vtkDataObject::DATA_OBJECT(), output);
156  output->FastDelete();
157  this->GetOutputPortInformation(i)->Set(
158  vtkDataObject::DATA_EXTENT_TYPE(), output->GetExtentType());
159  }
160  return 1;
161 }
static smeshGeoMesh * New()
static inpGeoMesh * New()
static exoGeoMesh * New()
static foamGeoMesh * New()
static vtkGeoMesh * New()
static oshGeoMesh * New()
static gmshGeoMesh * New()

◆ RequestInformation()

int NEM::SRV::srvBase::RequestInformation ( vtkInformation *  request,
vtkInformationVector **  inputVector,
vtkInformationVector *  outputVector 
)
protectedvirtual

Definition at line 97 of file srvBase.C.

Referenced by ~srvBase().

99  {
100  // do nothing let subclasses handle it
101  return 1;
102 }

◆ RequestUpdateExtent()

int NEM::SRV::srvBase::RequestUpdateExtent ( vtkInformation *  request,
vtkInformationVector **  inputVector,
vtkInformationVector *  outputVector 
)
protectedvirtual

Definition at line 163 of file srvBase.C.

Referenced by ~srvBase().

165  {
166  int numInputPorts = this->GetNumberOfInputPorts();
167  for (int i = 0; i < numInputPorts; i++) {
168  int numInputConnections = this->GetNumberOfInputConnections(i);
169  for (int j = 0; j < numInputConnections; j++) {
170  vtkInformation *inputInfo = inputVector[i]->GetInformationObject(j);
171  inputInfo->Set(vtkStreamingDemandDrivenPipeline::EXACT_EXTENT(), 1);
172  }
173  }
174  return 1;
175 }

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