Field: Add block member function to return sub-sets of the field as VectorSpaces
This commit is contained in:
parent
84dad12014
commit
4ac67d6ade
2 changed files with 16 additions and 0 deletions
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue