WIP: fv fields

This commit is contained in:
Mark Olesen 2023-01-23 15:04:03 +01:00
parent e655231e24
commit c3aecfab81
3 changed files with 38 additions and 56 deletions

View File

@ -39,7 +39,6 @@ Description
int main(int argc, char *argv[])
{
#include "setRootCase.H"
#include "createTime.H"
@ -47,11 +46,42 @@ int main(int argc, char *argv[])
const pointMesh& pMesh = pointMesh::New(mesh);
#if 1
pointLabelField state
(
IOobject
(
"test-state",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
pMesh
);
#else
pointLabelField state
(
IOobject
(
"test-state",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
pMesh,
dimensioned<label>(dimLength, 1),
pointPatchLabelField::calculatedType()
);
state.write();
#endif
pointVectorField U
(
IOobject
(
"U",
"test-U",
runTime.timeName(),
mesh,
IOobject::NO_READ,
@ -62,6 +92,8 @@ int main(int argc, char *argv[])
pointPatchVectorField::calculatedType()
);
U.write();
pointVectorField V(U + 2*U);
Info<< "End\n" << endl;

View File

@ -224,73 +224,21 @@ int main(int argc, char *argv[])
<< lerp(vector::uniform(0), vector::uniform(100), 0.5) << nl;
}
{
const lerpOp1<vector> half(0.5);
const vector a(vector::uniform(20));
const vector b(vector::uniform(100));
Info<< "lerp half: "
<< a << " : " << b << " => " << half(a, b) << nl;
}
{
const labelVector a(labelVector::uniform(10000));
const labelVector b(labelVector::uniform(1));
Info<< "lerp (labelVector) = "
Info<<"lerp (labelVector) = "
<< lerp(a, b, 0.1) << nl;
}
{
const scalar a(0);
const scalar b(100);
Info<< "lerp of " << a << " : " << b << nl;
for (const double t : { 0.0, 0.5, 1.0, -0.5, 1.5 })
{
Info<< " " << t << " = " << lerp(a, b, t) << nl;
}
}
// No yet
#if 0
{
const label a(10000);
const label b(1);
Info<<"lerp (label) = "
<< label(lerp(a, b, 0.1)) << nl;
}
{
const bool a(true);
const bool b(false);
Info<<"lerp (bool) = "
<< (lerp(a, b, 0.5)) << nl;
}
#endif
{
const sphericalTensor a(10), b(20);
Info<<"lerp exact: "
<< (a == lerp(a, b, 0.0f)) << " "
<< (b == lerp(a, b, 1.0f)) << nl;
// Info<< "lerp: "
// << lerp(vector::uniform(0), vector::uniform(100), 0.5) << nl;
}
{
const tensor a(tensor::uniform(1e24));
const tensor b(tensor::uniform(0));
Info<<"lerp exact: "
<< (a == lerp(a, b, 0.0f)) << " "
<< (b == lerp(a, b, 1.0f)) << nl;
//
// Info<< "lerp: "
// << lerp(vector::uniform(0), vector::uniform(100), 0.5) << nl;
}

View File

@ -87,6 +87,7 @@ void GeometricField<scalar, fvPatchField, volMesh>::replace
const Foam::wordList Foam::fieldTypes::internal
({
"volLabelField::Internal",
"volScalarField::Internal",
"volVectorField::Internal",
"volSphericalTensorField::Internal",
@ -97,6 +98,7 @@ const Foam::wordList Foam::fieldTypes::internal
const Foam::wordList Foam::fieldTypes::volume
({
"volLabelField",
"volScalarField",
"volVectorField",
"volSphericalTensorField",