Skip to content
Snippets Groups Projects
Commit 904e6ee6 authored by Norihiro Watanabe's avatar Norihiro Watanabe Committed by Dmitri Naumov
Browse files

support quadratic cell types in VtkMappedMesh

parent 9c011063
No related branches found
No related tags found
No related merge requests found
......@@ -60,31 +60,61 @@ vtkIdType VtkMappedMeshImpl::GetNumberOfCells()
int VtkMappedMeshImpl::GetCellType(vtkIdType cellId)
{
int type = 0;
switch ((*_elements)[cellId]->getGeomType())
switch ((*_elements)[cellId]->getCellType())
{
case MeshElemType::INVALID:
case CellType::INVALID:
break;
case MeshElemType::LINE:
case CellType::LINE2:
type = VTK_LINE;
break;
case MeshElemType::TRIANGLE:
case CellType::LINE3:
type = VTK_QUADRATIC_EDGE;
break;
case CellType::TRI3:
type = VTK_TRIANGLE;
break;
case MeshElemType::QUAD:
case CellType::TRI6:
type = VTK_QUADRATIC_TRIANGLE;
break;
case CellType::QUAD4:
type = VTK_QUAD;
break;
case MeshElemType::HEXAHEDRON:
case CellType::QUAD8:
type = VTK_QUADRATIC_QUAD;
break;
case CellType::QUAD9:
type = VTK_BIQUADRATIC_QUAD;
break;
case CellType::HEX8:
type = VTK_HEXAHEDRON;
break;
case MeshElemType::TETRAHEDRON:
case CellType::HEX20:
type = VTK_QUADRATIC_HEXAHEDRON;
break;
case CellType::HEX27:
type = VTK_TRIQUADRATIC_HEXAHEDRON;
break;
case CellType::TET4:
type = VTK_TETRA;
break;
case MeshElemType::PRISM:
case CellType::TET10:
type = VTK_QUADRATIC_TETRA;
break;
case CellType::PRISM6:
type = VTK_WEDGE;
break;
case MeshElemType::PYRAMID:
case CellType::PRISM15:
type = VTK_QUADRATIC_WEDGE;
break;
case CellType::PRISM18:
type = VTK_BIQUADRATIC_QUADRATIC_WEDGE;
break;
case CellType::PYRAMID5:
type = VTK_PYRAMID;
break;
case CellType::PYRAMID13:
type = VTK_QUADRATIC_PYRAMID;
break;
}
return type;
}
......@@ -133,16 +163,16 @@ void VtkMappedMeshImpl::GetIdsOfCellsOfType(int type, vtkIdTypeArray *array)
for (auto elem(_elements->begin()); elem != _elements->end(); ++elem)
{
if ((*elem)->getGeomType() == VtkCellTypeToOGS(type))
if ((*elem)->getCellType() == VtkCellTypeToOGS(type))
array->InsertNextValue((*elem)->getID());
}
}
int VtkMappedMeshImpl::IsHomogeneous()
{
MeshElemType type = (*(_elements->begin()))->getGeomType();
CellType type = (*(_elements->begin()))->getCellType();
for (auto elem(_elements->begin()); elem != _elements->end(); ++elem)
if((*elem)->getGeomType() != type)
if((*elem)->getCellType() != type)
return 0;
return 1;
}
......
......@@ -71,34 +71,64 @@ private:
const std::vector<MeshLib::Element*>* _elements;
vtkIdType NumberOfCells;
static MeshElemType VtkCellTypeToOGS(int type)
static CellType VtkCellTypeToOGS(int type)
{
MeshElemType ogs;
CellType ogs;
switch (type)
{
case VTK_LINE:
ogs = MeshElemType::LINE;
ogs = CellType::LINE2;
break;
case VTK_QUADRATIC_EDGE:
ogs = CellType::LINE3;
break;
case VTK_TRIANGLE:
ogs = MeshElemType::TRIANGLE;
ogs = CellType::TRI3;
break;
case VTK_QUADRATIC_TRIANGLE:
ogs = CellType::TRI6;
break;
case VTK_QUAD:
ogs = MeshElemType::QUAD;
ogs = CellType::QUAD4;
break;
case VTK_QUADRATIC_QUAD:
ogs = CellType::QUAD8;
break;
case VTK_BIQUADRATIC_QUAD:
ogs = CellType::QUAD9;
break;
case VTK_HEXAHEDRON:
ogs = MeshElemType::HEXAHEDRON;
ogs = CellType::HEX8;
break;
case VTK_QUADRATIC_HEXAHEDRON:
ogs = CellType::HEX20;
break;
case VTK_TRIQUADRATIC_HEXAHEDRON:
ogs = CellType::HEX27;
break;
case VTK_TETRA:
ogs = MeshElemType::TETRAHEDRON;
ogs = CellType::TET4;
break;
case VTK_QUADRATIC_TETRA:
ogs = CellType::TET10;
break;
case VTK_WEDGE:
ogs = MeshElemType::PRISM;
ogs = CellType::PRISM6;
break;
case VTK_QUADRATIC_WEDGE:
ogs = CellType::PRISM15;
break;
case VTK_BIQUADRATIC_QUADRATIC_WEDGE:
ogs = CellType::PRISM18;
break;
case VTK_PYRAMID:
ogs = MeshElemType::PYRAMID;
ogs = CellType::PYRAMID5;
break;
case VTK_QUADRATIC_PYRAMID:
ogs = CellType::PYRAMID13;
break;
default:
ogs = MeshElemType::INVALID;
ogs = CellType::INVALID;
break;
}
return ogs;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment