mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 13:23:51 +00:00
Implement extents support
Adds a variable `GlobalPointIndexStart` to `CellSetStructured`. Adding this to the cell-set, instead of the coordinate system, enables this feature for different types of datasets like uniform grid, rectilinear, etc., with this one change. The extents can be computed using `GlobalPointIndexStart` and `PointDimensions`.
This commit is contained in:
parent
bc13764228
commit
6d81bc8b06
@ -71,10 +71,20 @@ public:
|
||||
this->Structure.SetPointDimensions(dimensions);
|
||||
}
|
||||
|
||||
void SetGlobalPointIndexStart(SchedulingRangeType start)
|
||||
{
|
||||
this->Structure.SetGlobalPointIndexStart(start);
|
||||
}
|
||||
|
||||
SchedulingRangeType GetPointDimensions() const { return this->Structure.GetPointDimensions(); }
|
||||
|
||||
SchedulingRangeType GetCellDimensions() const { return this->Structure.GetCellDimensions(); }
|
||||
|
||||
SchedulingRangeType GetGlobalPointIndexStart() const
|
||||
{
|
||||
return this->Structure.GetGlobalPointIndexStart();
|
||||
}
|
||||
|
||||
vtkm::IdComponent GetNumberOfPointsInCell(vtkm::Id vtkmNotUsed(cellIndex) = 0) const
|
||||
{
|
||||
return this->Structure.GetNumberOfPointsInCell();
|
||||
@ -145,16 +155,20 @@ public:
|
||||
{
|
||||
diy::save(bb, cs.GetName());
|
||||
diy::save(bb, cs.GetPointDimensions());
|
||||
diy::save(bb, cs.GetGlobalPointIndexStart());
|
||||
}
|
||||
|
||||
static VTKM_CONT void load(BinaryBuffer& bb, Type& cs)
|
||||
{
|
||||
std::string name;
|
||||
diy::load(bb, name);
|
||||
typename Type::SchedulingRangeType dims;
|
||||
typename Type::SchedulingRangeType dims, start;
|
||||
diy::load(bb, dims);
|
||||
diy::load(bb, start);
|
||||
|
||||
cs = Type(name);
|
||||
cs.SetPointDimensions(dims);
|
||||
cs.SetGlobalPointIndexStart(start);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -119,6 +119,12 @@ public:
|
||||
return this->Internals.GetPointDimensions();
|
||||
}
|
||||
|
||||
VTKM_EXEC_CONT
|
||||
SchedulingRangeType GetGlobalPointIndexStart() const
|
||||
{
|
||||
return this->Internals.GetGlobalPointIndexStart();
|
||||
}
|
||||
|
||||
friend class ConnectivityStructured<ToTopology, FromTopology, Dimension>;
|
||||
|
||||
private:
|
||||
|
@ -47,6 +47,9 @@ public:
|
||||
VTKM_EXEC_CONT
|
||||
void SetPointDimensions(vtkm::Id dimensions) { this->PointDimensions = dimensions; }
|
||||
|
||||
VTKM_EXEC_CONT
|
||||
void SetGlobalPointIndexStart(vtkm::Id start) { this->GlobalPointIndexStart = start; }
|
||||
|
||||
VTKM_EXEC_CONT
|
||||
vtkm::Id GetPointDimensions() const { return this->PointDimensions; }
|
||||
|
||||
@ -65,6 +68,9 @@ public:
|
||||
return this->GetNumberOfPoints();
|
||||
}
|
||||
|
||||
VTKM_EXEC_CONT
|
||||
SchedulingRangeType GetGlobalPointIndexStart() const { return this->GlobalPointIndexStart; }
|
||||
|
||||
static constexpr vtkm::IdComponent NUM_POINTS_IN_CELL = 2;
|
||||
static constexpr vtkm::IdComponent MAX_CELL_TO_POINT = 2;
|
||||
|
||||
@ -147,7 +153,8 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
vtkm::Id PointDimensions;
|
||||
vtkm::Id PointDimensions = 0;
|
||||
vtkm::Id GlobalPointIndexStart = 0;
|
||||
};
|
||||
|
||||
//2 D specialization.
|
||||
@ -160,6 +167,9 @@ public:
|
||||
VTKM_EXEC_CONT
|
||||
void SetPointDimensions(vtkm::Id2 dims) { this->PointDimensions = dims; }
|
||||
|
||||
VTKM_EXEC_CONT
|
||||
void SetGlobalPointIndexStart(vtkm::Id2 start) { this->GlobalPointIndexStart = start; }
|
||||
|
||||
VTKM_EXEC_CONT
|
||||
const vtkm::Id2& GetPointDimensions() const { return this->PointDimensions; }
|
||||
|
||||
@ -181,6 +191,9 @@ public:
|
||||
return this->GetPointDimensions();
|
||||
}
|
||||
|
||||
VTKM_EXEC_CONT
|
||||
const vtkm::Id2& GetGlobalPointIndexStart() const { return this->GlobalPointIndexStart; }
|
||||
|
||||
static constexpr vtkm::IdComponent NUM_POINTS_IN_CELL = 4;
|
||||
static constexpr vtkm::IdComponent MAX_CELL_TO_POINT = 4;
|
||||
|
||||
@ -305,7 +318,8 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
vtkm::Id2 PointDimensions;
|
||||
vtkm::Id2 PointDimensions = { 0, 0 };
|
||||
vtkm::Id2 GlobalPointIndexStart = { 0, 0 };
|
||||
};
|
||||
|
||||
//3 D specialization.
|
||||
@ -323,6 +337,9 @@ public:
|
||||
this->CellDim01 = (dims[0] - 1) * (dims[1] - 1);
|
||||
}
|
||||
|
||||
VTKM_EXEC_CONT
|
||||
void SetGlobalPointIndexStart(vtkm::Id3 start) { this->GlobalPointIndexStart = start; }
|
||||
|
||||
VTKM_EXEC_CONT
|
||||
const vtkm::Id3& GetPointDimensions() const { return this->PointDimensions; }
|
||||
|
||||
@ -344,6 +361,9 @@ public:
|
||||
return this->GetPointDimensions();
|
||||
}
|
||||
|
||||
VTKM_EXEC_CONT
|
||||
const vtkm::Id3& GetGlobalPointIndexStart() const { return this->GlobalPointIndexStart; }
|
||||
|
||||
static constexpr vtkm::IdComponent NUM_POINTS_IN_CELL = 8;
|
||||
static constexpr vtkm::IdComponent MAX_CELL_TO_POINT = 8;
|
||||
|
||||
@ -498,9 +518,10 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
vtkm::Id3 PointDimensions;
|
||||
vtkm::Id3 CellDimensions;
|
||||
vtkm::Id CellDim01;
|
||||
vtkm::Id3 PointDimensions = { 0, 0, 0 };
|
||||
vtkm::Id3 GlobalPointIndexStart = { 0, 0, 0 };
|
||||
vtkm::Id3 CellDimensions = { 0, 0, 0 };
|
||||
vtkm::Id CellDim01 = 0;
|
||||
};
|
||||
|
||||
// We may want to generalize this class depending on how ConnectivityExplicit
|
||||
|
Loading…
Reference in New Issue
Block a user