mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: additional DimensionedField, GeometricField factory methods
- construct based on db and mesh information from an existing field - check movable() instead of isTmp() when reusing fields STYLE: isolate check for reuse GeometricField into Detail namespace
This commit is contained in:
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -65,8 +65,7 @@ int main(int argc, char *argv[])
|
||||
"tensor",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
{ IOobject::READ_IF_PRESENT, IOobject::NO_REGISTER }
|
||||
),
|
||||
mesh,
|
||||
dimensioned<tensor>(dimless, tensor(1,2,3,4,5,6,7,8,9))
|
||||
@ -75,6 +74,47 @@ int main(int argc, char *argv[])
|
||||
Info().beginBlock("transformed")
|
||||
<< tensorfld.T() << nl;
|
||||
Info().endBlock();
|
||||
|
||||
{
|
||||
auto tfld =
|
||||
DimensionedField<scalar, volMesh>::New
|
||||
(
|
||||
tensorfld,
|
||||
"scalar",
|
||||
dimensioned<scalar>(14)
|
||||
);
|
||||
|
||||
Info().beginBlock(tfld().type())
|
||||
<< tfld << nl;
|
||||
Info().endBlock();
|
||||
}
|
||||
|
||||
{
|
||||
auto tfld =
|
||||
volScalarField::New
|
||||
(
|
||||
"scalar",
|
||||
tensorfld.mesh(),
|
||||
dimensioned<scalar>(5)
|
||||
);
|
||||
|
||||
Info().beginBlock(tfld().type())
|
||||
<< tfld() << nl;
|
||||
Info().endBlock();
|
||||
|
||||
// From dissimilar types
|
||||
auto tfld2 =
|
||||
volVectorField::New
|
||||
(
|
||||
tfld(),
|
||||
"vector",
|
||||
dimensioned<vector>(Zero)
|
||||
);
|
||||
|
||||
Info().beginBlock(tfld2().type())
|
||||
<< tfld2() << nl;
|
||||
Info().endBlock();
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef TEST_UINT8_FIELD
|
||||
|
||||
Reference in New Issue
Block a user