Commit cb4f2911 authored by Florian Maurin's avatar Florian Maurin Committed by Kitware Robot
Browse files

Merge topic 'FixCompleteLagrangeWedgeAndTetra'

0f6bc35d Fix and test vtkCellTypeSource for LagrangeWedge21
392a7a84

 Fix triangulate for Lagrange tetra 15
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: David Thompson's avatarDavid Thompson <david.thompson@kitware.com>
Merge-request: !7863
parents dd2e8789 0f6bc35d
......@@ -93,12 +93,12 @@ double FifteenPointTetraCoords[15 * 3] = { 0., 0., 0., 1., 0., 0., 0., 1., 0., 0
0., .5, .5, 0., 0., .5, 0., 0., 0., .5, .5, 0., .5, 0., .5, .5, 1. / 3., 1. / 3., 0., 1. / 3., 0.,
1. / 3., 1. / 3., 1. / 3, 1. / 3., 0., 1. / 3., 1. / 3., .25, .25, .25 };
constexpr vtkIdType FifteenPointTetraSubtetras[28][4] = { { 0, 4, 10, 14 }, { 1, 4, 10, 14 },
{ 1, 5, 10, 14 }, { 2, 5, 10, 14 }, { 2, 6, 10, 14 }, { 0, 6, 10, 14 }, { 0, 7, 11, 14 },
{ 3, 7, 11, 14 }, { 3, 8, 11, 14 }, { 1, 8, 11, 14 }, { 1, 4, 11, 14 }, { 0, 4, 11, 14 },
{ 1, 5, 12, 14 }, { 2, 5, 12, 14 }, { 2, 9, 12, 14 }, { 3, 9, 12, 14 }, { 3, 8, 12, 14 },
{ 1, 8, 12, 14 }, { 0, 7, 13, 14 }, { 3, 7, 13, 14 }, { 3, 9, 13, 14 }, { 2, 9, 13, 14 },
{ 2, 6, 13, 14 }, { 0, 6, 13, 14 } };
constexpr vtkIdType FifteenPointTetraSubtetras[24][4] = { { 0, 4, 10, 14 }, { 4, 1, 10, 14 },
{ 1, 5, 10, 14 }, { 5, 2, 10, 14 }, { 2, 6, 10, 14 }, { 6, 0, 10, 14 }, { 4, 0, 11, 14 },
{ 1, 4, 11, 14 }, { 8, 1, 11, 14 }, { 3, 8, 11, 14 }, { 7, 3, 11, 14 }, { 0, 7, 11, 14 },
{ 5, 1, 12, 14 }, { 2, 5, 12, 14 }, { 9, 2, 12, 14 }, { 3, 9, 12, 14 }, { 8, 3, 12, 14 },
{ 1, 8, 12, 14 }, { 7, 0, 13, 14 }, { 3, 7, 13, 14 }, { 9, 3, 13, 14 }, { 2, 9, 13, 14 },
{ 6, 2, 13, 14 }, { 0, 6, 13, 14 } };
#endif
}
......@@ -250,7 +250,7 @@ vtkIdType vtkHigherOrderTetra::ComputeNumberOfSubtetras()
#ifdef FIFTEEN_POINT_TETRA
if (this->Points->GetNumberOfPoints() == 15)
{
return 28;
return 24;
}
#endif
vtkIdType order = this->GetOrder();
......
......@@ -1712,7 +1712,8 @@ void vtkCellTypeSource::GenerateLagrangeWedges(vtkUnstructuredGrid* output, int
// additionally holds the number of points. Since
// vtkLagrangeWedge::PointIndexFromIJK expects the order to be a 4-array, we
// use this convention here.
const int order[4] = { this->CellOrder, this->CellOrder, this->CellOrder, numPtsPerCell };
const int order[4] = { this->CellOrder, this->CellOrder, this->CellOrder,
(this->CellOrder + 1) * (this->CellOrder + 1) * (this->CellOrder + 2) / 2 };
output->Allocate(numCells * (numPtsPerCell + 1));
std::vector<vtkIdType> cta;
......@@ -2208,7 +2209,8 @@ void vtkCellTypeSource::GenerateBezierWedges(vtkUnstructuredGrid* output, int ex
// additionally holds the number of points. Since
// vtkBezierWedge::PointIndexFromIJK expects the order to be a 4-array, we
// use this convention here.
const int order[4] = { this->CellOrder, this->CellOrder, this->CellOrder, numPtsPerCell };
const int order[4] = { this->CellOrder, this->CellOrder, this->CellOrder,
(this->CellOrder + 1) * (this->CellOrder + 1) * (this->CellOrder + 2) / 2 };
output->Allocate(numCells * (numPtsPerCell + 1));
std::vector<vtkIdType> cta;
......
......@@ -43,54 +43,94 @@ int CellSizeFilter2(int vtkNotUsed(argc), char* vtkNotUsed(argv)[])
if (fabs(length->GetValue(0) - 1.0) > .0001)
{
vtkGenericWarningMacro("Wrong length dimension for the cell source type "
<< OneDCellTypes[i] << " supposed to be 1.0 whereas it is " << length->GetValue(0));
<< vtkCellTypes::GetClassNameFromTypeId(OneDCellTypes[i])
<< " supposed to be 1.0 whereas it is " << length->GetValue(0));
return EXIT_FAILURE;
}
}
std::vector<bool> complete;
for (int i = 0; i < NumberOf2DCellTypes; i++)
{
if (ThreeDCellTypes[i] == VTK_TRIANGLE)
{
complete = { false, true };
}
else
{
complete = { false };
}
for (size_t j = 0; j < complete.size(); j++)
{
vtkNew<vtkCellTypeSource> cellTypeSource;
cellTypeSource->SetBlocksDimensions(1, 1, 1);
if (complete[j])
{
cellTypeSource->SetCellOrder(2);
}
else
{
cellTypeSource->SetCellOrder(3);
}
cellTypeSource->SetCompleteQuadraticSimplicialElements(complete[j]);
cellTypeSource->SetCellType(TwoDCellTypes[i]);
vtkNew<vtkCellSizeFilter> filter;
filter->SetInputConnection(cellTypeSource->GetOutputPort());
filter->ComputeSumOn();
filter->Update();
vtkNew<vtkCellTypeSource> cellTypeSource;
cellTypeSource->SetBlocksDimensions(1, 1, 1);
cellTypeSource->SetCellOrder(2);
cellTypeSource->SetCellType(TwoDCellTypes[i]);
vtkNew<vtkCellSizeFilter> filter;
filter->SetInputConnection(cellTypeSource->GetOutputPort());
filter->ComputeSumOn();
filter->Update();
vtkDoubleArray* area = vtkDoubleArray::SafeDownCast(
vtkUnstructuredGrid::SafeDownCast(filter->GetOutput())->GetFieldData()->GetArray("Area"));
vtkDoubleArray* area = vtkDoubleArray::SafeDownCast(
vtkUnstructuredGrid::SafeDownCast(filter->GetOutput())->GetFieldData()->GetArray("Area"));
if (fabs(area->GetValue(0) - 1.0) > .0001)
{
vtkGenericWarningMacro("Wrong area dimension for the cell source type "
<< TwoDCellTypes[i] << " supposed to be 1.0 whereas it is " << area->GetValue(0));
return EXIT_FAILURE;
if (fabs(area->GetValue(0) - 1.0) > .0001)
{
vtkGenericWarningMacro("Wrong area dimension for the cell source type "
<< vtkCellTypes::GetClassNameFromTypeId(TwoDCellTypes[i])
<< " supposed to be 1.0 whereas it is " << area->GetValue(0));
return EXIT_FAILURE;
}
}
}
for (int i = 0; i < NumberOf3DCellTypes; i++)
{
if (ThreeDCellTypes[i] == VTK_LAGRANGE_TETRAHEDRON || ThreeDCellTypes[i] == VTK_LAGRANGE_WEDGE)
{
complete = { false, true };
}
else
{
complete = { false };
}
for (size_t j = 0; j < complete.size(); j++)
{
vtkNew<vtkCellTypeSource> cellTypeSource;
cellTypeSource->SetBlocksDimensions(1, 1, 1);
if (complete[j])
{
cellTypeSource->SetCellOrder(2);
}
else
{
cellTypeSource->SetCellOrder(3);
}
cellTypeSource->SetCompleteQuadraticSimplicialElements(complete[j]);
cellTypeSource->SetCellType(ThreeDCellTypes[i]);
vtkNew<vtkCellSizeFilter> filter;
filter->SetInputConnection(cellTypeSource->GetOutputPort());
filter->ComputeSumOn();
filter->Update();
vtkNew<vtkCellTypeSource> cellTypeSource;
cellTypeSource->SetBlocksDimensions(1, 1, 1);
cellTypeSource->SetCellOrder(3);
cellTypeSource->SetCellType(ThreeDCellTypes[i]);
vtkNew<vtkCellSizeFilter> filter;
filter->SetInputConnection(cellTypeSource->GetOutputPort());
filter->ComputeSumOn();
filter->Update();
vtkDoubleArray* volume = vtkDoubleArray::SafeDownCast(
vtkUnstructuredGrid::SafeDownCast(filter->GetOutput())->GetFieldData()->GetArray("Volume"));
vtkDoubleArray* volume = vtkDoubleArray::SafeDownCast(
vtkUnstructuredGrid::SafeDownCast(filter->GetOutput())->GetFieldData()->GetArray("Volume"));
if (fabs(volume->GetValue(0) - 1.0) > .0001)
{
vtkGenericWarningMacro("Wrong volume dimension for the cell source type "
<< ThreeDCellTypes[i] << " supposed to be 1.0 whereas it is " << volume->GetValue(0));
return EXIT_FAILURE;
if (fabs(volume->GetValue(0) - 1.0) > .0001)
{
vtkGenericWarningMacro("Wrong volume dimension for the cell source type "
<< vtkCellTypes::GetClassNameFromTypeId(ThreeDCellTypes[i])
<< " supposed to be 1.0 whereas it is " << volume->GetValue(0));
return EXIT_FAILURE;
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment