16#include <vtkObjectFactory.h>
17#include <vtkVariant.h>
18#include <vtkVariantCast.h>
25template <
class Scalar> VtkMeshNodalCoordinatesTemplate<Scalar> *
26VtkMeshNodalCoordinatesTemplate<Scalar>::New()
28 VTK_STANDARD_NEW_BODY(VtkMeshNodalCoordinatesTemplate<Scalar>);
31template <
class Scalar>
void VtkMeshNodalCoordinatesTemplate<Scalar>
32::PrintSelf(ostream &os, vtkIndent indent)
45 this->_nodes =
nullptr;
46 delete [] this->TempDoubleArray;
47 this->TempDoubleArray =
nullptr;
50 this->NumberOfComponents = 1;
53template <
class Scalar>
55 std::vector<Node*>
const& nodes)
59 this->NumberOfComponents = 3;
60 this->Size = this->NumberOfComponents * _nodes->size();
61 this->MaxId = this->Size - 1;
62 this->TempDoubleArray =
new double [this->NumberOfComponents];
69 vtkDataArray *outArray = vtkDataArray::FastDownCast(output);
72 vtkWarningMacro(<<
"Input is not a vtkDataArray");
76 const vtkIdType numTuples = ptIds->GetNumberOfIds();
78 outArray->SetNumberOfComponents(this->NumberOfComponents);
79 outArray->SetNumberOfTuples(numTuples);
81 const vtkIdType numPoints = ptIds->GetNumberOfIds();
82 for (vtkIdType i = 0; i < numPoints; i++)
84 outArray->SetTuple(i, this->GetTuple(ptIds->GetId(i)));
89::GetTuples(vtkIdType p1, vtkIdType p2, vtkAbstractArray *output)
91 vtkDataArray *da = vtkDataArray::FastDownCast(output);
94 vtkWarningMacro(<<
"Input is not a vtkDataArray");
98 if(da->GetNumberOfComponents() != this->GetNumberOfComponents())
100 vtkErrorMacro(<<
"Incorrect number of components in input array.");
104 for (vtkIdType daTubleId = 0; p1 <= p2; ++p1)
106 da->SetTuple(daTubleId++, this->GetTuple(p1));
119 vtkErrorMacro(<<
"Not implemented.");
127 Scalar val = vtkVariantCast<Scalar>(value, &valid);
130 return this->Lookup(val, 0);
139 Scalar val = vtkVariantCast<Scalar>(value, &valid);
144 while ((index = this->Lookup(val, index)) >= 0)
146 ids->InsertNextId(index++);
154 return vtkVariant(this->GetValueReference(idx));
166 this->GetTuple(i, this->TempDoubleArray);
167 return this->TempDoubleArray;
173 tuple[0] = (*(*this->_nodes)[i])[0];
174 tuple[1] = (*(*this->_nodes)[i])[1];
175 tuple[2] = (*(*this->_nodes)[i])[2];
181 return this->Lookup(value, 0);
189 while ((index = this->Lookup(value, index)) >= 0)
191 ids->InsertNextId(index++);
198 const vtkIdType tuple = idx / this->NumberOfComponents;
199 const vtkIdType comp = idx % this->NumberOfComponents;
200 return (*(*this->_nodes)[tuple])[comp];
203template <
class Scalar>
207 vtkErrorMacro(
"Read only container.");
211template <
class Scalar>
214 vtkErrorMacro(
"Read only container.");
218template <
class Scalar>
222 vtkErrorMacro(
"Read only container.");
226template <
class Scalar>
228 vtkIdType , vtkIdType , vtkAbstractArray* )
230 vtkErrorMacro(
"Read only container.");
234template <
class Scalar>
238 vtkErrorMacro(
"Read only container.");
242template <
class Scalar>
246 vtkErrorMacro(
"Read only container.");
250template <
class Scalar>
252 vtkIdType , vtkIdType , vtkAbstractArray* )
254 vtkErrorMacro(
"Read only container.");
258template <
class Scalar>
260 vtkIdType ,
const float* )
262 vtkErrorMacro(
"Read only container.");
266template <
class Scalar>
268 vtkIdType ,
const double* )
270 vtkErrorMacro(
"Read only container.");
274template <
class Scalar>
276 vtkIdList* , vtkIdList* , vtkAbstractArray* )
278 vtkErrorMacro(
"Read only container.");
282template <
class Scalar>
284 vtkIdType , vtkIdType , vtkIdType ,
287 vtkErrorMacro(
"Read only container.");
291template <
class Scalar>
293 vtkIdType , vtkAbstractArray* )
295 vtkErrorMacro(
"Read only container.");
299template <
class Scalar>
303 vtkErrorMacro(
"Read only container.");
307template <
class Scalar>
311 vtkErrorMacro(
"Read only container.");
318 vtkErrorMacro(
"Read only container.");
321template <
class Scalar>
325 vtkErrorMacro(
"Read only container.");
329template <
class Scalar>
332 vtkErrorMacro(
"Read only container.");
336template <
class Scalar>
338 vtkIdType , vtkIdList* , vtkAbstractArray* ,
341 vtkErrorMacro(
"Read only container.");
345template <
class Scalar>
347 vtkIdType , vtkIdType , vtkAbstractArray* ,
348 vtkIdType , vtkAbstractArray* ,
double )
350 vtkErrorMacro(
"Read only container.");
354template <
class Scalar>
356 vtkIdType , vtkVariant )
358 vtkErrorMacro(
"Read only container.");
362template <
class Scalar>
365 vtkErrorMacro(
"Read only container.");
372 vtkErrorMacro(
"Read only container.");
379 vtkErrorMacro(
"Read only container.");
383template <
class Scalar>
387 vtkErrorMacro(
"Read only container.");
391template <
class Scalar>
395 vtkErrorMacro(
"Read only container.");
399template <
class Scalar>
403 vtkErrorMacro(
"Read only container.");
407template <
class Scalar>
414 delete [] this->TempDoubleArray;
420 while(index <= this->MaxId)
422 if (this->GetValueReference(index++) == val)
434 const vtkIdType tuple = idx / this->NumberOfComponents;
435 const vtkIdType comp = idx % this->NumberOfComponents;
436 return (*(*this->_nodes)[tuple])[comp];
442 return this->GetValueReference(idx);
448 tuple[0] = (*(*this->_nodes)[tupleId])[0];
449 tuple[1] = (*(*this->_nodes)[tupleId])[1];
450 tuple[2] = (*(*this->_nodes)[tupleId])[2];
453template <
class Scalar>
455 vtkIdType ,
const Scalar* )
457 vtkErrorMacro(
"Read only container.");
461template <
class Scalar>
463 vtkIdType ,
const Scalar* )
465 vtkErrorMacro(
"Read only container.");
469template <
class Scalar>
473 vtkErrorMacro(
"Read only container.");
Definition of the Node class.
void SetValue(vtkIdType idx, Scalar value) override
void InsertTuple(vtkIdType i, vtkIdType j, vtkAbstractArray *source) override
void RemoveTuple(vtkIdType id) override
vtkIdType InsertNextValue(Scalar v) override
void SetVariantValue(vtkIdType idx, vtkVariant value) override
void InsertTuples(vtkIdList *dstIds, vtkIdList *srcIds, vtkAbstractArray *source) override
vtkIdType InsertNextTypedTuple(const Scalar *t) override
void InsertValue(vtkIdType idx, Scalar v) override
void SetTypedTuple(vtkIdType i, const Scalar *t) override
void DeepCopy(vtkAbstractArray *aa) override
void SetNodes(std::vector< Node * > const &nodes)
Pass the nodes from OGS mesh.
int Allocate(vtkIdType sz, vtkIdType ext) override
void InterpolateTuple(vtkIdType i, vtkIdList *ptIndices, vtkAbstractArray *source, double *weights) override
void InsertTypedTuple(vtkIdType i, const Scalar *t) override
void SetTuple(vtkIdType i, vtkIdType j, vtkAbstractArray *source) override
void SetNumberOfTuples(vtkIdType number) override
int Resize(vtkIdType numTuples) override
VtkMeshNodalCoordinatesTemplate()
vtkIdType InsertNextTuple(vtkIdType j, vtkAbstractArray *source) override