Merge topic 'removeGhostStructured'
0e236d4d0 Merge branch 'master' of https://gitlab.kitware.com/vtk/vtk-m into removeGhostStructured 0c3a9864e temp remove the std::numeric_limits 5308fec43 Merge branch 'master' of https://gitlab.kitware.com/vtk/vtk-m into removeGhostStructured 228599685 Add test for non-structured case. a425d89ff fix compiler warning. f6b41808b Structured preserving ghost removal. Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !1560
This commit is contained in:
commit
5bff3a0b45
@ -43,6 +43,8 @@ public:
|
||||
VTKM_CONT
|
||||
GhostZone();
|
||||
|
||||
VTKM_CONT
|
||||
void RemoveGhostField() { this->RemoveField = true; }
|
||||
VTKM_CONT
|
||||
void RemoveAllGhost() { this->RemoveAll = true; }
|
||||
VTKM_CONT
|
||||
@ -52,13 +54,15 @@ public:
|
||||
this->RemoveVals = vals;
|
||||
}
|
||||
VTKM_CONT
|
||||
bool GetRemoveGhostField() { return this->RemoveField; }
|
||||
VTKM_CONT
|
||||
bool GetRemoveAllGhost() const { return this->RemoveAll; }
|
||||
|
||||
VTKM_CONT
|
||||
void ConvertOutputToUnstructured() { this->ConvertToUnstructured = true; }
|
||||
|
||||
VTKM_CONT
|
||||
vtkm::UInt8 GetRemoveByType() const { return !this->RemoveAll; }
|
||||
bool GetRemoveByType() const { return !this->RemoveAll; }
|
||||
VTKM_CONT
|
||||
vtkm::UInt8 GetRemoveType() const { return this->RemoveVals; }
|
||||
VTKM_CONT
|
||||
@ -80,6 +84,7 @@ public:
|
||||
|
||||
private:
|
||||
bool RemoveAll;
|
||||
bool RemoveField;
|
||||
bool ConvertToUnstructured;
|
||||
vtkm::UInt8 RemoveVals;
|
||||
vtkm::worklet::Threshold Worklet;
|
||||
|
@ -23,6 +23,8 @@
|
||||
#include <vtkm/cont/CellSetPermutation.h>
|
||||
#include <vtkm/cont/DynamicCellSet.h>
|
||||
|
||||
#include <vtkm/RangeId3.h>
|
||||
#include <vtkm/filter/ExtractStructured.h>
|
||||
#include <vtkm/worklet/CellDeepCopy.h>
|
||||
#include <vtkm/worklet/DispatcherMapTopology.h>
|
||||
|
||||
@ -62,6 +64,236 @@ private:
|
||||
vtkm::UInt8 RemoveType;
|
||||
};
|
||||
|
||||
template <int DIMS>
|
||||
VTKM_EXEC_CONT vtkm::Vec<vtkm::Id, 3> getLogical(const vtkm::Id& index,
|
||||
const vtkm::Vec<vtkm::Id, 3>& cellDims);
|
||||
|
||||
template <>
|
||||
VTKM_EXEC_CONT vtkm::Vec<vtkm::Id, 3> getLogical<3>(const vtkm::Id& index,
|
||||
const vtkm::Vec<vtkm::Id, 3>& cellDims)
|
||||
{
|
||||
vtkm::Vec<vtkm::Id, 3> res(0, 0, 0);
|
||||
res[0] = index % cellDims[0];
|
||||
res[1] = (index / (cellDims[0])) % (cellDims[1]);
|
||||
res[2] = index / ((cellDims[0]) * (cellDims[1]));
|
||||
return res;
|
||||
}
|
||||
|
||||
template <>
|
||||
VTKM_EXEC_CONT vtkm::Vec<vtkm::Id, 3> getLogical<2>(const vtkm::Id& index,
|
||||
const vtkm::Vec<vtkm::Id, 3>& cellDims)
|
||||
{
|
||||
vtkm::Vec<vtkm::Id, 3> res(0, 0, 0);
|
||||
res[0] = index % cellDims[0];
|
||||
res[1] = index / cellDims[0];
|
||||
return res;
|
||||
}
|
||||
|
||||
template <>
|
||||
VTKM_EXEC_CONT vtkm::Vec<vtkm::Id, 3> getLogical<1>(const vtkm::Id& index,
|
||||
const vtkm::Vec<vtkm::Id, 3>&)
|
||||
{
|
||||
vtkm::Vec<vtkm::Id, 3> res(0, 0, 0);
|
||||
res[0] = index;
|
||||
return res;
|
||||
}
|
||||
|
||||
template <int DIMS>
|
||||
class RealMinMax : public vtkm::worklet::WorkletMapField
|
||||
{
|
||||
public:
|
||||
VTKM_CONT
|
||||
RealMinMax(vtkm::Vec<vtkm::Id, 3> cellDims, bool removeAllGhost, vtkm::UInt8 removeType)
|
||||
: CellDims(cellDims)
|
||||
, RemoveAllGhost(removeAllGhost)
|
||||
, RemoveType(removeType)
|
||||
{
|
||||
}
|
||||
|
||||
typedef void ControlSignature(FieldIn, AtomicArrayInOut);
|
||||
typedef void ExecutionSignature(_1, InputIndex, _2);
|
||||
|
||||
template <typename Atomic>
|
||||
VTKM_EXEC void Max(Atomic& atom, const vtkm::Id& val, const vtkm::Id& index) const
|
||||
{
|
||||
vtkm::Id old = -1;
|
||||
do
|
||||
{
|
||||
old = atom.CompareAndSwap(index, val, old);
|
||||
} while (old < val);
|
||||
}
|
||||
|
||||
template <typename Atomic>
|
||||
VTKM_EXEC void Min(Atomic& atom, const vtkm::Id& val, const vtkm::Id& index) const
|
||||
{
|
||||
vtkm::Id old = 1000000000;
|
||||
do
|
||||
{
|
||||
old = atom.CompareAndSwap(index, val, old);
|
||||
} while (old > val);
|
||||
}
|
||||
|
||||
template <typename T, typename AtomicType>
|
||||
VTKM_EXEC void operator()(const T& value, const vtkm::Id& index, AtomicType& atom) const
|
||||
{
|
||||
// we are finding the logical min max of valid zones
|
||||
if ((RemoveAllGhost && value != 0) || (!RemoveAllGhost && (value != 0 && value | RemoveType)))
|
||||
return;
|
||||
|
||||
vtkm::Vec<vtkm::Id, 3> logical = getLogical<DIMS>(index, CellDims);
|
||||
|
||||
Min(atom, logical[0], 0);
|
||||
Min(atom, logical[1], 1);
|
||||
Min(atom, logical[2], 2);
|
||||
|
||||
Max(atom, logical[0], 3);
|
||||
Max(atom, logical[1], 4);
|
||||
Max(atom, logical[2], 5);
|
||||
}
|
||||
|
||||
private:
|
||||
vtkm::Vec<vtkm::Id, 3> CellDims;
|
||||
bool RemoveAllGhost;
|
||||
vtkm::UInt8 RemoveType;
|
||||
};
|
||||
|
||||
template <int DIMS>
|
||||
VTKM_EXEC_CONT bool checkRange(const vtkm::RangeId3& range, const vtkm::Vec<vtkm::Id, 3>& p);
|
||||
|
||||
template <>
|
||||
VTKM_EXEC_CONT bool checkRange<1>(const vtkm::RangeId3& range, const vtkm::Vec<vtkm::Id, 3>& p)
|
||||
{
|
||||
return p[0] >= range.X.Min && p[0] <= range.X.Max;
|
||||
}
|
||||
template <>
|
||||
VTKM_EXEC_CONT bool checkRange<2>(const vtkm::RangeId3& range, const vtkm::Vec<vtkm::Id, 3>& p)
|
||||
{
|
||||
return p[0] >= range.X.Min && p[0] <= range.X.Max && p[1] >= range.Y.Min && p[1] <= range.Y.Max;
|
||||
}
|
||||
template <>
|
||||
VTKM_EXEC_CONT bool checkRange<3>(const vtkm::RangeId3& range, const vtkm::Vec<vtkm::Id, 3>& p)
|
||||
{
|
||||
return p[0] >= range.X.Min && p[0] <= range.X.Max && p[1] >= range.Y.Min && p[1] <= range.Y.Max &&
|
||||
p[2] >= range.Z.Min && p[2] <= range.Z.Max;
|
||||
}
|
||||
|
||||
template <int DIMS>
|
||||
class Validate : public vtkm::worklet::WorkletMapField
|
||||
{
|
||||
public:
|
||||
VTKM_CONT
|
||||
Validate(const vtkm::Vec<vtkm::Id, 3>& cellDims,
|
||||
bool removeAllGhost,
|
||||
vtkm::UInt8 removeType,
|
||||
const vtkm::RangeId3& range)
|
||||
: CellDims(cellDims)
|
||||
, RemoveAll(removeAllGhost)
|
||||
, RemoveVal(removeType)
|
||||
, Range(range)
|
||||
{
|
||||
}
|
||||
|
||||
typedef void ControlSignature(FieldIn, FieldOut);
|
||||
typedef void ExecutionSignature(_1, InputIndex, _2);
|
||||
|
||||
template <typename T>
|
||||
VTKM_EXEC void operator()(const T& value, const vtkm::Id& index, vtkm::UInt8& valid) const
|
||||
{
|
||||
valid = 0;
|
||||
if (RemoveAll && value == 0)
|
||||
return;
|
||||
else if (!RemoveAll && (value == 0 || (value & RemoveVal)))
|
||||
return;
|
||||
|
||||
if (checkRange<DIMS>(Range, getLogical<DIMS>(index, CellDims)))
|
||||
valid = static_cast<vtkm::UInt8>(1);
|
||||
}
|
||||
|
||||
private:
|
||||
vtkm::Vec<vtkm::Id, 3> CellDims;
|
||||
bool RemoveAll;
|
||||
vtkm::UInt8 RemoveVal;
|
||||
vtkm::RangeId3 Range;
|
||||
};
|
||||
|
||||
template <int DIMS, typename T, typename StorageType>
|
||||
bool CanStrip(const vtkm::cont::ArrayHandle<T, StorageType>& ghostField,
|
||||
bool removeAllGhost,
|
||||
vtkm::UInt8 removeType,
|
||||
vtkm::RangeId3& range,
|
||||
const vtkm::Vec<vtkm::Id, 3>& cellDims,
|
||||
vtkm::Id size)
|
||||
{
|
||||
vtkm::cont::ArrayHandle<vtkm::Id> minmax;
|
||||
minmax.Allocate(6);
|
||||
minmax.GetPortalControl().Set(0, std::numeric_limits<vtkm::Id>::max());
|
||||
minmax.GetPortalControl().Set(1, std::numeric_limits<vtkm::Id>::max());
|
||||
minmax.GetPortalControl().Set(2, std::numeric_limits<vtkm::Id>::max());
|
||||
minmax.GetPortalControl().Set(3, std::numeric_limits<vtkm::Id>::min());
|
||||
minmax.GetPortalControl().Set(4, std::numeric_limits<vtkm::Id>::min());
|
||||
minmax.GetPortalControl().Set(5, std::numeric_limits<vtkm::Id>::min());
|
||||
|
||||
vtkm::worklet::DispatcherMapField<RealMinMax<3>>(
|
||||
RealMinMax<3>(cellDims, removeAllGhost, removeType))
|
||||
.Invoke(ghostField, minmax);
|
||||
|
||||
auto portal = minmax.GetPortalConstControl();
|
||||
range = vtkm::RangeId3(
|
||||
portal.Get(0), portal.Get(3), portal.Get(1), portal.Get(4), portal.Get(2), portal.Get(5));
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::UInt8> validFlags;
|
||||
validFlags.Allocate(size);
|
||||
|
||||
vtkm::worklet::DispatcherMapField<Validate<DIMS>>(
|
||||
Validate<DIMS>(cellDims, removeAllGhost, removeType, range))
|
||||
.Invoke(ghostField, validFlags);
|
||||
|
||||
vtkm::UInt8 res = vtkm::cont::Algorithm::Reduce(validFlags, vtkm::UInt8(0), vtkm::Maximum());
|
||||
return res == 0;
|
||||
}
|
||||
|
||||
template <typename T, typename StorageType>
|
||||
bool CanDoStructuredStrip(const vtkm::cont::DynamicCellSet& cells,
|
||||
const vtkm::cont::ArrayHandle<T, StorageType>& ghostField,
|
||||
bool removeAllGhost,
|
||||
vtkm::UInt8 removeType,
|
||||
vtkm::RangeId3& range)
|
||||
{
|
||||
bool canDo = false;
|
||||
vtkm::Id3 cellDims(1, 1, 1);
|
||||
|
||||
if (cells.IsSameType(vtkm::cont::CellSetStructured<1>()))
|
||||
{
|
||||
auto cells1D = cells.Cast<vtkm::cont::CellSetStructured<1>>();
|
||||
vtkm::Id d = cells1D.GetCellDimensions();
|
||||
cellDims[0] = d;
|
||||
vtkm::Id sz = d;
|
||||
|
||||
canDo =
|
||||
CanStrip<1, T, StorageType>(ghostField, removeAllGhost, removeType, range, cellDims, sz);
|
||||
}
|
||||
else if (cells.IsSameType(vtkm::cont::CellSetStructured<2>()))
|
||||
{
|
||||
auto cells2D = cells.Cast<vtkm::cont::CellSetStructured<2>>();
|
||||
vtkm::Id2 d = cells2D.GetCellDimensions();
|
||||
cellDims[0] = d[0];
|
||||
cellDims[1] = d[1];
|
||||
vtkm::Id sz = cellDims[0] * cellDims[1];
|
||||
canDo =
|
||||
CanStrip<2, T, StorageType>(ghostField, removeAllGhost, removeType, range, cellDims, sz);
|
||||
}
|
||||
else if (cells.IsSameType(vtkm::cont::CellSetStructured<3>()))
|
||||
{
|
||||
auto cells3D = cells.Cast<vtkm::cont::CellSetStructured<3>>();
|
||||
cellDims = cells3D.GetCellDimensions();
|
||||
vtkm::Id sz = cellDims[0] * cellDims[1] * cellDims[2];
|
||||
canDo =
|
||||
CanStrip<3, T, StorageType>(ghostField, removeAllGhost, removeType, range, cellDims, sz);
|
||||
}
|
||||
|
||||
return canDo;
|
||||
}
|
||||
|
||||
} // end anon namespace
|
||||
|
||||
namespace vtkm
|
||||
@ -73,10 +305,12 @@ namespace filter
|
||||
inline VTKM_CONT GhostZone::GhostZone()
|
||||
: vtkm::filter::FilterDataSetWithField<GhostZone>()
|
||||
, RemoveAll(false)
|
||||
, RemoveField(false)
|
||||
, ConvertToUnstructured(false)
|
||||
, RemoveVals(0)
|
||||
{
|
||||
this->SetActiveField("vtkmGhostCells");
|
||||
this->SetFieldsToPass("vtkmGhostCells", vtkm::filter::FieldSelection::MODE_EXCLUDE);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -89,9 +323,32 @@ inline VTKM_CONT vtkm::cont::DataSet GhostZone::DoExecute(
|
||||
{
|
||||
//get the cells and coordinates of the dataset
|
||||
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet(this->GetActiveCellSetIndex());
|
||||
|
||||
vtkm::cont::DynamicCellSet cellOut;
|
||||
|
||||
//Preserve structured output where possible.
|
||||
if (cells.IsSameType(vtkm::cont::CellSetStructured<1>()) ||
|
||||
cells.IsSameType(vtkm::cont::CellSetStructured<2>()) ||
|
||||
cells.IsSameType(vtkm::cont::CellSetStructured<3>()))
|
||||
{
|
||||
vtkm::RangeId3 range;
|
||||
if (CanDoStructuredStrip<T, StorageType>(
|
||||
cells, field, this->GetRemoveAllGhost(), this->GetRemoveType(), range))
|
||||
{
|
||||
vtkm::filter::ExtractStructured extract;
|
||||
vtkm::RangeId3 erange(
|
||||
range.X.Min, range.X.Max + 2, range.Y.Min, range.Y.Max + 2, range.Z.Min, range.Z.Max + 2);
|
||||
vtkm::Id3 sample(1, 1, 1);
|
||||
extract.SetVOI(erange);
|
||||
extract.SetSampleRate(sample);
|
||||
if (this->GetRemoveGhostField())
|
||||
extract.SetFieldsToPass(this->GetActiveFieldName(),
|
||||
vtkm::filter::FieldSelection::MODE_EXCLUDE);
|
||||
|
||||
auto output = extract.Execute(input, vtkm::filter::GhostZonePolicy());
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
||||
if (this->GetRemoveAllGhost())
|
||||
cellOut = this->Worklet.Run(vtkm::filter::ApplyPolicy(cells, policy),
|
||||
field,
|
||||
|
@ -27,13 +27,17 @@
|
||||
|
||||
#include <vtkm/filter/GhostZone.h>
|
||||
|
||||
#include <vtkm/io/writer/VTKDataSetWriter.h>
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
static vtkm::cont::ArrayHandle<vtkm::UInt8> StructuredGhostZoneArray(vtkm::Id nx,
|
||||
vtkm::Id ny,
|
||||
vtkm::Id nz,
|
||||
int numLayers)
|
||||
int numLayers,
|
||||
bool addMidGhost = false)
|
||||
{
|
||||
vtkm::Id numCells = nx * ny;
|
||||
if (nz > 0)
|
||||
@ -52,12 +56,12 @@ static vtkm::cont::ArrayHandle<vtkm::UInt8> StructuredGhostZoneArray(vtkm::Id nx
|
||||
else
|
||||
portal.Set(i, duplicateCell);
|
||||
}
|
||||
|
||||
if (numLayers > 0)
|
||||
{
|
||||
//2D case
|
||||
if (nz == 0)
|
||||
{
|
||||
//std::cout<<"dims: "<<nx<<" "<<ny<<": "<<nx-numLayers<<" "<<ny-numLayers<<std::endl;
|
||||
for (vtkm::Id i = numLayers; i < nx - numLayers; i++)
|
||||
for (vtkm::Id j = numLayers; j < ny - numLayers; j++)
|
||||
portal.Set(j * nx + i, normalCell);
|
||||
@ -71,21 +75,39 @@ static vtkm::cont::ArrayHandle<vtkm::UInt8> StructuredGhostZoneArray(vtkm::Id nx
|
||||
}
|
||||
}
|
||||
|
||||
if (addMidGhost)
|
||||
{
|
||||
if (nz == 0)
|
||||
{
|
||||
vtkm::Id mi = numLayers + (nx - numLayers) / 2;
|
||||
vtkm::Id mj = numLayers + (ny - numLayers) / 2;
|
||||
portal.Set(mj * nx + mi, duplicateCell);
|
||||
}
|
||||
else
|
||||
{
|
||||
vtkm::Id mi = numLayers + (nx - numLayers) / 2;
|
||||
vtkm::Id mj = numLayers + (ny - numLayers) / 2;
|
||||
vtkm::Id mk = numLayers + (nz - numLayers) / 2;
|
||||
portal.Set(mk * nx * ny + mj * nx + mi, duplicateCell);
|
||||
}
|
||||
}
|
||||
return ghosts;
|
||||
}
|
||||
|
||||
static vtkm::cont::DataSet MakeUniform(vtkm::Id numI, vtkm::Id numJ, vtkm::Id numK, int numLayers)
|
||||
static vtkm::cont::DataSet MakeUniform(vtkm::Id numI,
|
||||
vtkm::Id numJ,
|
||||
vtkm::Id numK,
|
||||
int numLayers,
|
||||
bool addMidGhost = false)
|
||||
{
|
||||
vtkm::cont::DataSetBuilderUniform dsb;
|
||||
|
||||
vtkm::cont::DataSet ds;
|
||||
|
||||
if (numK == 0)
|
||||
ds = dsb.Create(vtkm::Id2(numI + 1, numJ + 1));
|
||||
else
|
||||
ds = dsb.Create(vtkm::Id3(numI + 1, numJ + 1, numK + 1));
|
||||
|
||||
auto ghosts = StructuredGhostZoneArray(numI, numJ, numK, numLayers);
|
||||
auto ghosts = StructuredGhostZoneArray(numI, numJ, numK, numLayers, addMidGhost);
|
||||
|
||||
vtkm::cont::DataSetFieldAdd dsf;
|
||||
dsf.AddCellField(ds, "vtkmGhostCells", ghosts);
|
||||
@ -96,7 +118,8 @@ static vtkm::cont::DataSet MakeUniform(vtkm::Id numI, vtkm::Id numJ, vtkm::Id nu
|
||||
static vtkm::cont::DataSet MakeRectilinear(vtkm::Id numI,
|
||||
vtkm::Id numJ,
|
||||
vtkm::Id numK,
|
||||
int numLayers)
|
||||
int numLayers,
|
||||
bool addMidGhost = false)
|
||||
{
|
||||
vtkm::cont::DataSetBuilderRectilinear dsb;
|
||||
vtkm::cont::DataSet ds;
|
||||
@ -120,7 +143,7 @@ static vtkm::cont::DataSet MakeRectilinear(vtkm::Id numI,
|
||||
ds = dsb.Create(x, y, z);
|
||||
}
|
||||
|
||||
auto ghosts = StructuredGhostZoneArray(numI, numJ, numK, numLayers);
|
||||
auto ghosts = StructuredGhostZoneArray(numI, numJ, numK, numLayers, addMidGhost);
|
||||
|
||||
vtkm::cont::DataSetFieldAdd dsf;
|
||||
dsf.AddCellField(ds, "vtkmGhostCells", ghosts);
|
||||
@ -206,15 +229,13 @@ static vtkm::cont::DataSet MakeExplicit(vtkm::Id numI, vtkm::Id numJ, vtkm::Id n
|
||||
return ds;
|
||||
}
|
||||
|
||||
void TestStructured()
|
||||
void TestGhostZone()
|
||||
{
|
||||
std::cout << "Testing ghost cells for uniform datasets." << std::endl;
|
||||
|
||||
// specify some 2d tests: {numI, numJ, numK, numGhostLayers}.
|
||||
std::vector<std::vector<vtkm::Id>> tests2D = { { 4, 4, 0, 2 }, { 5, 5, 0, 3 }, { 10, 10, 0, 3 },
|
||||
std::vector<std::vector<vtkm::Id>> tests2D = { { 4, 4, 0, 2 }, { 5, 5, 0, 2 }, { 10, 10, 0, 3 },
|
||||
{ 10, 5, 0, 2 }, { 5, 10, 0, 2 }, { 20, 10, 0, 3 },
|
||||
{ 10, 20, 0, 3 } };
|
||||
std::vector<std::vector<vtkm::Id>> tests3D = { { 4, 4, 4, 2 }, { 5, 5, 5, 3 },
|
||||
std::vector<std::vector<vtkm::Id>> tests3D = { { 4, 4, 4, 2 }, { 5, 5, 5, 2 },
|
||||
{ 10, 10, 10, 3 }, { 10, 5, 10, 2 },
|
||||
{ 5, 10, 10, 2 }, { 20, 10, 10, 3 },
|
||||
{ 10, 20, 10, 3 } };
|
||||
@ -230,10 +251,10 @@ void TestStructured()
|
||||
int nghost = static_cast<int>(t[3]);
|
||||
for (int layer = 0; layer < nghost; layer++)
|
||||
{
|
||||
vtkm::cont::DataSet ds;
|
||||
std::vector<std::string> dsTypes = { "uniform", "rectilinear", "explicit" };
|
||||
for (auto& dsType : dsTypes)
|
||||
{
|
||||
vtkm::cont::DataSet ds;
|
||||
if (dsType == "uniform")
|
||||
ds = MakeUniform(nx, ny, nz, layer);
|
||||
else if (dsType == "rectilinear")
|
||||
@ -245,6 +266,8 @@ void TestStructured()
|
||||
for (auto& rt : removeType)
|
||||
{
|
||||
vtkm::filter::GhostZone ghostZoneRemoval;
|
||||
ghostZoneRemoval.RemoveGhostField();
|
||||
|
||||
if (rt == "all")
|
||||
ghostZoneRemoval.RemoveAllGhost();
|
||||
else if (rt == "byType")
|
||||
@ -268,25 +291,43 @@ void TestStructured()
|
||||
numCellsReq *= (nz - 2 * layer);
|
||||
|
||||
VTKM_TEST_ASSERT(numCellsReq == numCells, "Wrong number of cells in output");
|
||||
if (ot == "explicit")
|
||||
if (dsType == "uniform" || dsType == "rectilinear")
|
||||
{
|
||||
if (nz == 0)
|
||||
VTKM_TEST_ASSERT(
|
||||
output.GetCellSet(0).IsSameType(vtkm::cont::CellSetStructured<2>()),
|
||||
"Wrong cell type for explicit conversion");
|
||||
else if (nz > 0)
|
||||
VTKM_TEST_ASSERT(
|
||||
output.GetCellSet(0).IsSameType(vtkm::cont::CellSetStructured<3>()),
|
||||
"Wrong cell type for explicit conversion");
|
||||
}
|
||||
else if (ot == "explicit")
|
||||
VTKM_TEST_ASSERT(output.GetCellSet(0).IsType<vtkm::cont::CellSetExplicit<>>(),
|
||||
"Wrong cell type for explicit conversion");
|
||||
}
|
||||
}
|
||||
|
||||
// For structured, test the case where we have a ghost in the 'middle' of the cells.
|
||||
// This will produce an explicit cellset.
|
||||
if (dsType == "uniform" || dsType == "rectilinear")
|
||||
{
|
||||
if (dsType == "uniform")
|
||||
ds = MakeUniform(nx, ny, nz, layer, true);
|
||||
else if (dsType == "rectilinear")
|
||||
ds = MakeRectilinear(nx, ny, nz, layer, true);
|
||||
|
||||
vtkm::filter::GhostZone ghostZoneRemoval;
|
||||
ghostZoneRemoval.RemoveGhostField();
|
||||
ghostZoneRemoval.ConvertOutputToUnstructured();
|
||||
auto output = ghostZoneRemoval.Execute(ds, vtkm::filter::GhostZonePolicy());
|
||||
VTKM_TEST_ASSERT(output.GetCellSet(0).IsType<vtkm::cont::CellSetExplicit<>>(),
|
||||
"Wrong cell type for explicit conversion");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TestExplicit()
|
||||
{
|
||||
}
|
||||
|
||||
void TestGhostZone()
|
||||
{
|
||||
TestStructured();
|
||||
TestExplicit();
|
||||
}
|
||||
}
|
||||
|
||||
int UnitTestGhostZone(int argc, char* argv[])
|
||||
|
Loading…
Reference in New Issue
Block a user