Changes for supporting cell centered velocity fields
- Changing the Field class for handling field associativity - Changing Streamline filter to handle cell fields
This commit is contained in:
parent
5c3fa80afc
commit
cf012b61e4
@ -19,6 +19,7 @@
|
||||
#include <vtkm/worklet/particleadvection/TemporalGridEvaluators.h>
|
||||
|
||||
#include <memory>
|
||||
#include <typeinfo>
|
||||
#include <vector>
|
||||
|
||||
namespace vtkm
|
||||
@ -93,12 +94,13 @@ public:
|
||||
: DataSetIntegratorBase<vtkm::worklet::particleadvection::GridEvaluator<
|
||||
vtkm::worklet::particleadvection::VelocityField<FieldHandleType>>>(false, id)
|
||||
{
|
||||
using Association = vtkm::cont::Field::Association;
|
||||
using FieldType = vtkm::worklet::particleadvection::VelocityField<FieldHandleType>;
|
||||
using EvalType = vtkm::worklet::particleadvection::GridEvaluator<FieldType>;
|
||||
Association association = ds.GetField(fieldNm).GetAssociation();
|
||||
auto fieldArray = this->GetFieldHandle(ds, fieldNm);
|
||||
|
||||
using EvalType = vtkm::worklet::particleadvection::GridEvaluator<
|
||||
vtkm::worklet::particleadvection::VelocityField<FieldHandleType>>;
|
||||
|
||||
this->Eval = std::shared_ptr<EvalType>(new EvalType(ds, fieldArray));
|
||||
FieldType field(fieldArray, association);
|
||||
this->Eval = std::shared_ptr<EvalType>(new EvalType(ds, field));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -30,15 +30,27 @@ class ExecutionVelocityField
|
||||
{
|
||||
public:
|
||||
using FieldPortalType = typename FieldArrayType::ReadPortalType;
|
||||
using Association = vtkm::cont::Field::Association;
|
||||
|
||||
VTKM_CONT
|
||||
ExecutionVelocityField(FieldArrayType velocityValues,
|
||||
ExecutionVelocityField(const FieldArrayType& velocityValues,
|
||||
const Association assoc,
|
||||
vtkm::cont::DeviceAdapterId device,
|
||||
vtkm::cont::Token& token)
|
||||
: VelocityValues(velocityValues.PrepareForInput(device, token))
|
||||
, Assoc(assoc)
|
||||
{
|
||||
}
|
||||
|
||||
VTKM_EXEC Association GetAssociation() const { return this->Assoc; }
|
||||
|
||||
VTKM_EXEC void GetValue(const vtkm::Id cellId, ValueType& value) const
|
||||
{
|
||||
VTKM_ASSERT(this->Assoc == Association::CELL_SET);
|
||||
|
||||
value = VelocityValues.Get(cellId);
|
||||
}
|
||||
|
||||
VTKM_EXEC void GetValue(const vtkm::VecVariable<vtkm::Id, 8>& indices,
|
||||
const vtkm::Id vertices,
|
||||
const vtkm::Vec3f& parametric,
|
||||
@ -62,23 +74,39 @@ class ExecutionElectroMagneticField
|
||||
{
|
||||
public:
|
||||
using FieldPortalType = typename FieldArrayType::ReadPortalType;
|
||||
using Association = vtkm::cont::Field::Association;
|
||||
|
||||
VTKM_CONT
|
||||
ExecutionElectroMagneticField(FieldArrayType electricValues,
|
||||
FieldArrayType magneticValues,
|
||||
ExecutionElectroMagneticField(const FieldArrayType& electricValues,
|
||||
const FieldArrayType& magneticValues,
|
||||
const Association assoc,
|
||||
vtkm::cont::DeviceAdapterId device,
|
||||
vtkm::cont::Token& token)
|
||||
: ElectricValues(electricValues.PrepareForInput(device, token))
|
||||
, MagneticValues(magneticValues.PrepareForInput(device, token))
|
||||
, Assoc(assoc)
|
||||
{
|
||||
}
|
||||
|
||||
VTKM_EXEC Association GetAssociation() const { return this->Assoc; }
|
||||
|
||||
VTKM_EXEC void GetValue(const vtkm::Id cellId, ValueType& value) const
|
||||
{
|
||||
VTKM_ASSERT(this->Assoc == Association::CELL_SET);
|
||||
|
||||
auto electric = this->ElectricValues.Get(cellId);
|
||||
auto magnetic = this->MagneticValues.Get(cellId);
|
||||
value = vtkm::make_Vec(electric, magnetic);
|
||||
}
|
||||
|
||||
VTKM_EXEC void GetValue(const vtkm::VecVariable<vtkm::Id, 8>& indices,
|
||||
const vtkm::Id vertices,
|
||||
const vtkm::Vec3f& parametric,
|
||||
const vtkm::UInt8 cellShape,
|
||||
vtkm::VecVariable<vtkm::Vec3f, 2>& value) const
|
||||
{
|
||||
VTKM_ASSERT(this->Assoc == Association::POINTS);
|
||||
|
||||
vtkm::Vec3f electricInterp, magneticInterp;
|
||||
vtkm::VecVariable<vtkm::Vec3f, 8> electric;
|
||||
vtkm::VecVariable<vtkm::Vec3f, 8> magnetic;
|
||||
@ -110,6 +138,17 @@ public:
|
||||
VelocityField(const FieldArrayType& fieldValues)
|
||||
: FieldValues(fieldValues)
|
||||
{
|
||||
std::cout << "Here here 1" << std::endl;
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
VelocityField(const FieldArrayType& fieldValues, const Association assoc)
|
||||
: FieldValues(fieldValues)
|
||||
, Assoc(assoc)
|
||||
{
|
||||
std::cout << "Here here 2" << std::endl;
|
||||
if (assoc == Association::ANY || assoc == Association::WHOLE_MESH)
|
||||
throw("Unsupported field association");
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
@ -136,6 +175,17 @@ public:
|
||||
ElectroMagneticField(const FieldArrayType& electricField, const FieldArrayType& magneticField)
|
||||
: ElectricField(electricField)
|
||||
, MagneticField(magneticField)
|
||||
, Assoc(vtkm::cont::Field::Association::POINTS)
|
||||
{
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
ElectroMagneticField(const FieldArrayType& electricField,
|
||||
const FieldArrayType& magneticField,
|
||||
const Association assoc)
|
||||
: ElectricField(electricField)
|
||||
, MagneticField(magneticField)
|
||||
, Assoc(assoc)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -125,8 +125,17 @@ public:
|
||||
vtkm::IdComponent nVerts;
|
||||
vtkm::VecVariable<vtkm::Id, 8> ptIndices;
|
||||
vtkm::VecVariable<vtkm::Vec3f, 8> fieldValues;
|
||||
this->InterpolationHelper.GetCellInfo(cellId, cellShape, nVerts, ptIndices);
|
||||
this->Field.GetValue(ptIndices, nVerts, parametric, cellShape, out);
|
||||
|
||||
if (this->Field.GetAssociation() == vtkm::cont::Field::Association::POINTS)
|
||||
{
|
||||
this->InterpolationHelper.GetCellInfo(cellId, cellShape, nVerts, ptIndices);
|
||||
this->Field.GetValue(ptIndices, nVerts, parametric, cellShape, out);
|
||||
}
|
||||
else if (this->Field.GetAssociation() == vtkm::cont::Field::Association::CELL_SET)
|
||||
{
|
||||
this->Field.GetValue(cellId, out);
|
||||
}
|
||||
|
||||
status.SetOk();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user