29 #ifndef vtkCGNSReaderInternal_h 30 #define vtkCGNSReaderInternal_h 54 static const bool value =
false;
66 static const bool value =
false;
117 vtkCGNSArraySelection::const_iterator iter = other.begin();
118 for (; iter != other.end(); ++iter)
120 (*this)[iter->first] = iter->second;
124 void AddArray(
const char* name,
bool status =
true) { (*this)[name] = status; }
128 vtkCGNSArraySelection::iterator iter = this->find(name);
129 if (iter != this->end())
140 vtkCGNSArraySelection::iterator iter = this->find(name);
141 return (iter != this->end());
146 void SetArrayStatus(
const char* name,
bool status) { this->AddArray(name, status); }
151 for (vtkCGNSArraySelection::iterator iter = this->begin(); iter != this->end(); ++iter)
156 return iter->first.c_str();
173 CGNS_ENUMT(DataType_t) dt;
182 CGNS_ENUMT(DataType_t) dt;
211 this->name[0] =
'\0';
221 std::vector<CGNSRead::ZoneBCInformation>
bcs;
225 this->name[0] =
'\0';
273 std::vector<CGNSRead::FamilyInformation>
family;
276 std::vector<CGNSRead::ZoneInformation>
zones;
299 const std::string& patchFamilyname);
310 bool Parse(
const char* cgnsFileName);
325 std::vector<double>&
GetTimes() {
return this->GlobalTime; }
330 void PrintSelf(std::ostream& os);
346 std::vector<CGNSRead::BaseInformation> baseList;
347 std::string LastReadFilename;
349 std::vector<double> GlobalTime;
354 inline bool compareName(
const char_33 nameOne,
const char_33 nameTwo)
356 return (strncmp(nameOne, nameTwo, 32) == 0);
363 char* end = name + strlen(name) - 1;
364 while (end >= name && isspace(*end))
369 assert(end >= name && end < name + 33);
376 std::vector<CGNSVector>& vectorList,
const char_33 name)
378 for (std::vector<CGNSVector>::iterator iter = vectorList.begin(); iter != vectorList.end();
381 if (strncmp(iter->name, name, 31) == 0)
386 return vectorList.end();
390 inline bool isACGNSVariable(
const std::vector<CGNSVariable>& varList,
const char_33 name)
392 for (std::vector<CGNSVariable>::const_iterator iter = varList.begin(); iter != varList.end();
395 if (strncmp(iter->name, name, 32) == 0)
405 std::vector<CGNSRead::CGNSVector>& vectors,
const int physicalDim);
407 int setUpRind(
const int cgioNum,
const double rindId,
int* rind);
414 const int cgioNum,
const double parentId,
const char* label,
double*
id,
const char*
name = NULL);
427 CGNS_ENUMT(ElementType_t) elemType,
bool& higherOrderWarning,
bool& cgnsOrderFlag);
433 template <
typename T,
typename Y>
434 int get_XYZ_mesh(
const int cgioNum,
const std::vector<double>& gridChildId,
435 const std::size_t& nCoordsArray,
const int cellDim,
const vtkIdType nPts,
441 T* currentCoord =
static_cast<T*
>(&(coords[0]));
445 bool sameType =
true;
448 memset(coords, 0, 3 * nPts *
sizeof(T));
450 for (std::size_t c = 1; c <= nCoordsArray; ++c)
453 if (cgio_get_name(cgioNum, gridChildId[c - 1], coordName) != CG_OK)
456 cgio_error_message(message);
457 std::cerr <<
"get_XYZ_mesh : cgio_get_name :" << message;
462 if (cgio_get_data_type(cgioNum, gridChildId[c - 1], dataType))
467 if (strcmp(dataType,
"R8") == 0)
470 sameType = doubleType;
472 else if (strcmp(dataType,
"R4") == 0)
475 sameType = floatType;
479 std::cerr <<
"Invalid datatype for GridCoordinates\n";
484 len = strlen(coordName) - 1;
485 switch (coordName[len])
488 currentCoord =
static_cast<T*
>(&(coords[0]));
491 currentCoord =
static_cast<T*
>(&(coords[1]));
494 currentCoord =
static_cast<T*
>(&(coords[2]));
498 coordId = gridChildId[c - 1];
501 if (sameType ==
true)
503 constexpr
const char* dtNameT = detail::cgns_type_name<T>();
504 if (cgio_read_data_type(cgioNum, coordId, srcStart, srcEnd, srcStride, dtNameT, cellDim,
505 memEnd, memStart, memEnd, memStride, (
void*)currentCoord))
508 cgio_error_message(message);
509 std::cerr <<
"cgio_read_data_type :" << message;
514 constexpr
const char* dtNameY = detail::cgns_type_name<Y>();
516 const cgsize_t memNoStride[3] = { 1, 1, 1 };
519 dataArray =
new Y[nPts];
522 std::cerr <<
"Error allocating buffer array\n";
525 if (cgio_read_data_type(cgioNum, coordId, srcStart, srcEnd, srcStride, dtNameY, cellDim,
526 memDims, memStart, memDims, memNoStride, (
void*)dataArray))
530 cgio_error_message(message);
531 std::cerr <<
"Buffer array cgio_read_data_type :" << message;
536 currentCoord[memStride[0] * ii] =
static_cast<T
>(dataArray[ii]);
545 #endif // vtkCGNSReaderInternal_h
bool ReadBase(vtkCGNSReader *reader, const BaseInformation &baseInfo)
Helpers to encapsulate all logic to read various nodes (zones, bc patches etc.).
void SetArrayStatus(const char *name, bool status)
constexpr const char * cgns_type_name< vtkTypeInt32 >() noexcept
void fillVectorsFromVars(std::vector< CGNSRead::CGNSVariable > &vars, std::vector< CGNSRead::CGNSVector > &vectors, const int physicalDim)
void CGNS2VTKorder(const vtkIdType size, const int *cells_types, vtkIdType *elements)
int get_XYZ_mesh(const int cgioNum, const std::vector< double > &gridChildId, const std::size_t &nCoordsArray, const int cellDim, const vtkIdType nPts, const cgsize_t *srcStart, const cgsize_t *srcEnd, const cgsize_t *srcStride, const cgsize_t *memStart, const cgsize_t *memEnd, const cgsize_t *memStride, const cgsize_t *memDims, vtkPoints *points)
bool isACGNSVariable(const std::vector< CGNSVariable > &varList, const char_33 name)
bool ReadDataForZone(vtkCGNSReader *reader, const BaseInformation &baseInfo, const ZoneInformation &zoneInfo)
Helpers to encapsulate all logic to read various nodes (zones, bc patches etc.).
constexpr const char * cgns_type_name< float >() noexcept
void removeTrailingWhiteSpaces(char_33 name)
void Merge(const vtkCGNSArraySelection &other)
int GetVTKElemType(CGNS_ENUMT(ElementType_t) elemType, bool &higherOrderWarning, bool &cgnsOrderFlag)
constexpr const char * cgns_type_name() noexcept
int getFirstNodeId(const int cgioNum, const double parentId, const char *label, double *id, const char *name=NULL)
Find the first node with the given label.
bool ReadPatch(vtkCGNSReader *reader, const BaseInformation &, const ZoneInformation &zoneInfo, const std::string &patchFamilyname)
Helpers to encapsulate all logic to read various nodes (zones, bc patches etc.).
const char * GetArrayName(int index)
bool HasArray(const char *name)
constexpr const char * cgns_type_name< double >() noexcept
void * GetVoidPointer(const int id)
vtkCGNSReader creates a multi-block dataset and reads unstructured grids, and structured meshes from ...
void AddArray(const char *name, bool status=true)
int get_section_connectivity(const int cgioNum, const double cgioSectionId, const int dim, const cgsize_t *srcStart, const cgsize_t *srcEnd, const cgsize_t *srcStride, const cgsize_t *memStart, const cgsize_t *memEnd, const cgsize_t *memStride, const cgsize_t *memDim, vtkIdType *localElements)
int setUpRind(const int cgioNum, const double rindId, int *rind)
int get_section_start_offset(const int cgioNum, const double cgioSectionId, const int dim, const cgsize_t *srcStart, const cgsize_t *srcEnd, const cgsize_t *srcStride, const cgsize_t *memStart, const cgsize_t *memEnd, const cgsize_t *memStride, const cgsize_t *memDim, vtkIdType *localElementsIdx)
std::vector< CGNSVector >::iterator getVectorFromName(std::vector< CGNSVector > &vectorList, const char_33 name)
bool ReadGridForZone(vtkCGNSReader *reader, const BaseInformation &baseInfo, const ZoneInformation &zoneInfo)
Helpers to encapsulate all logic to read various nodes (zones, bc patches etc.).
void CGNS2VTKorderMonoElem(const vtkIdType size, const int cell_type, vtkIdType *elements)
int GetArraySetting(const char *name)
bool compareName(const char_33 nameOne, const char_33 nameTwo)
constexpr const char * cgns_type_name< vtkTypeInt64 >() noexcept
bool ArrayIsEnabled(const char *name)
bool ReadPatchesForBase(vtkCGNSReader *reader, const BaseInformation &)
Helpers to encapsulate all logic to read various nodes (zones, bc patches etc.).