Field: Add block member function to return sub-sets of the field as VectorSpaces

This commit is contained in:
Henry Weller
2016-03-30 18:17:51 +01:00
parent 6e5b35bb69
commit f1ecdd77e6
2 changed files with 16 additions and 0 deletions

View File

@ -611,6 +611,19 @@ void Foam::Field<Type>::replace
}
template<class Type>
template<class VSForm>
VSForm Foam::Field<Type>::block(const label start) const
{
VSForm vs;
for (direction i=0; i<VSForm::nComponents; i++)
{
vs[i] = this->operator[](start + i);
}
return vs;
}
template<class Type>
Foam::tmp<Foam::Field<Type>> Foam::Field<Type>::T() const
{

View File

@ -333,6 +333,9 @@ public:
//- Replace a component field of the field
void replace(const direction, const cmptType&);
template<class VSForm>
VSForm block(const label start) const;
//- Return the field transpose (only defined for second rank tensors)
tmp<Field<Type>> T() const;