access to data
// access to field<Type>
Ex: in /finiteVolume/fields/fvPatchField/derived/turbulentInlet.C.
This class is templated, here we take a example for vector field:
to have access to x-component for example
where ".component" is a member function to return component field of a field : meaning the return type is still a field.
It seems that vectorField is a List of vectors and that when returning calling .component it returns a scalarField (maybe, at least I expected), therefore cmptType in the following (field.H) is scalar not a vector :
But randomField is of field<vector> type and Type must be replaced by vector. The return type of the above function is then tmp<Field<pTraits<vector>> not really a scalar field as we expected !!
// access to dimensioned<Type>
// src/OpenFOAM/dimensionedTypes/dimensionedType/dimensionedType.H
need to perform accessor .value()
Ex: in /finiteVolume/fields/fvPatchField/derived/turbulentInlet.C.
This class is templated, here we take a example for vector field:
Code:
Field<vector> randomField(this->size());
Code:
Info << "randomField = " << randomField.component(vector::X) << endl; // vector::X=0 this enum equals to 0 as enum's defaut value: Y=1, Z=2
It seems that vectorField is a List of vectors and that when returning calling .component it returns a scalarField (maybe, at least I expected), therefore cmptType in the following (field.H) is scalar not a vector :
Code:
333 //- Return a component field of the field 334 tmp<Field<cmptType>> component(const direction) const;
Code:
86 //- Component type 87 typedef typename pTraits<Type>::cmptType cmptType;
// src/OpenFOAM/dimensionedTypes/dimensionedType/dimensionedType.H
need to perform accessor .value()
Total Comments 0