3#ifndef vtkDGInvokeOperator_h
4#define vtkDGInvokeOperator_h
9#include "vtkFiltersCellGridModule.h"
15VTK_ABI_NAMESPACE_BEGIN
68 this->Coefficients = vals;
74 this->Coefficients->GetTuple(ii, tuple.data());
90 this->Coefficients = vals;
91 this->Connectivity = conn;
98 this->Connectivity->GetIntegerTuple(ii, this->ConnTuple.data());
99 auto valIt = tuple.begin();
100 for (
const auto& valId : this->ConnTuple)
102 this->Coefficients->GetTuple(valId, &(*valIt));
103 valIt += this->Stride;
115 template <
typename InputIterator,
typename OutputIterator>
117 InputIterator begin, InputIterator end, OutputIterator out);
123 template <
typename InputIterator,
typename OutputIterator>
125 InputIterator begin, InputIterator end, OutputIterator out);
126 template <
typename InputIterator,
typename OutputIterator>
128 InputIterator begin, InputIterator end, OutputIterator out);
137 template <
typename OutputIterator>
139 const std::array<double, 3>&
rst, OutputIterator& out);
149 std::size_t num,
const vtkIdType* cellIds,
const double*
rst,
double* result);
164template <
typename InputIterator,
typename OutputIterator>
169 if (info.DOFSharing.IsValid())
179template <
typename InputIterator,
typename OutputIterator>
190 auto valsit = info.ArraysByRole.find(
"values"_token);
191 if (valsit == info.ArraysByRole.end() || !valsit->second)
195 auto connit = info.ArraysByRole.find(
"connectivity"_token);
196 if (connit == info.ArraysByRole.end() || !connit->second)
201 vtkDataArray::SafeDownCast(valsit->second), vtkDataArray::SafeDownCast(connit->second));
202 int coefficientsPerDOF = valsit->second->GetNumberOfComponents();
203 this->
CoeffTuple.resize(connit->second->GetNumberOfComponents() * coefficientsPerDOF);
212 for (
auto initer = begin; initer != end; ++initer)
214 if (lastCellId != initer.GetCellId())
216 lastCellId = initer.GetCellId();
219 this->
InnerProduct(coefficientsPerDOF, stride, op, initer.GetParameter(), out);
224template <
typename InputIterator,
typename OutputIterator>
235 auto valsit = info.ArraysByRole.find(
"values"_token);
236 if (valsit == info.ArraysByRole.end() || !valsit->second)
241 int totalCoefficients = valsit->second->GetNumberOfComponents();
253 for (
auto initer = begin; initer != end; ++initer)
255 if (lastCellId != initer.GetCellId())
257 lastCellId = initer.GetCellId();
260 this->
InnerProduct(coefficientsPerDOF, stride, op, initer.GetParameter(), out);
265template <
typename OutputIterator>
272 std::memset(&(out[0]), 0,
sizeof(
double) * stride);
274 for (
int ii = 0; ii < coefficientsPerDOF; ++ii)
int GetNumberOfComponents() const
Set/Get the dimension (n) of the components.
Invoke a DG-cell operator, weighting basis functions by coefficients.
std::vector< double > CoeffTuple
Hold the function coefficients for a single cell.
std::vector< double > OperatorTuple
Hold the function values for a single (r,s,t) evaluation.
bool InvokeSharedDOF(const vtkDGOperatorEntry &op, const vtkCellAttribute::CellTypeInfo &info, InputIterator begin, InputIterator end, OutputIterator out)
Hold the function coefficients for a single cell.
void InnerProduct(int coefficientsPerDOF, int stride, const vtkDGOperatorEntry &op, const std::array< double, 3 > &rst, OutputIterator &out)
Invoke the operator op once on rst and compute the inner product.
bool InvokeOp(const vtkDGOperatorEntry &op, const vtkCellAttribute::CellTypeInfo &info, InputIterator begin, InputIterator end, OutputIterator out)
Given input cells and parametric coordinates to iterate, evaluate the operator and store the results ...
bool InvokeUnsharedDOF(const vtkDGOperatorEntry &op, const vtkCellAttribute::CellTypeInfo &info, InputIterator begin, InputIterator end, OutputIterator out)
bool Invoke(const vtkDGOperatorEntry &op, const vtkCellAttribute::CellTypeInfo &info, std::size_t num, const vtkIdType *cellIds, const double *rst, double *result)
This is a convenience method that makes invoking the operator from python (as well as C++) simpler.
FetchUnsharedCellDOF DiscontinuousFetcher
Fetch values into CoeffTuple when DOF are not shared.
vtkDGInvokeOperator(const vtkDGInvokeOperator &)=default
FetchSharedCellDOF SharedFetcher
Fetch values into CoeffTuple when DOF are shared among cells by connectivity.
vtkDGInvokeOperator()=default
A record for a basis in a function space that is specific to one cell shape.
int OperatorSize
The number of coordinates each operator-function evaluates to.
OperatorFunction Op
A function you may call to evaluate the operator.
int NumberOfFunctions
The number of functions in the basis.
abstract superclass for arrays of numeric data
FetchSharedCellDOF()=default
void operator()(vtkIdType ii, std::vector< double > &tuple)
std::vector< vtkTypeInt64 > ConnTuple
FetchSharedCellDOF(vtkDataArray *vals, vtkDataArray *conn)
void Initialize(vtkDataArray *vals, vtkDataArray *conn)
FetchUnsharedCellDOF(vtkDataArray *vals, vtkDataArray *conn)
void Initialize(vtkDataArray *vals, vtkDataArray *conn=nullptr)
FetchUnsharedCellDOF()=default
void operator()(vtkIdType ii, std::vector< double > &tuple)