ENH: function obejct updates

This commit is contained in:
andy
2013-10-04 16:44:58 +01:00
parent 184a4c7c67
commit 837ca32397
35 changed files with 261 additions and 195 deletions

View File

@ -51,7 +51,15 @@ Foam::fieldCoordinateSystemTransform::fieldCoordinateSystemTransform
coordSys_(obr, dict)
{
// Check if the available mesh is an fvMesh otherise deactivate
if (!isA<fvMesh>(obr_))
if (isA<fvMesh>(obr_))
{
read(dict);
Info<< type() << " " << name_ << ":" << nl
<< " Applying transformation from global Cartesian to local "
<< coordSys_ << nl << endl;
}
else
{
active_ = false;
WarningIn
@ -63,15 +71,9 @@ Foam::fieldCoordinateSystemTransform::fieldCoordinateSystemTransform
"const dictionary&, "
"const bool"
")"
) << "No fvMesh available, deactivating."
) << "No fvMesh available, deactivating " << name_
<< endl;
}
read(dict);
Info<< type() << ":" << nl
<< " Applying transformation from global Cartesian to local "
<< coordSys_ << nl << endl;
}
@ -112,6 +114,8 @@ void Foam::fieldCoordinateSystemTransform::timeSet()
void Foam::fieldCoordinateSystemTransform::write()
{
Info<< type() << " " << name_ << " output:" << nl;
forAll(fieldSet_, fieldI)
{
// If necessary load field

View File

@ -39,25 +39,9 @@ void Foam::fieldCoordinateSystemTransform::transformField
{
const word& fieldName = field.name() + "Transformed";
dimensionedTensor R("R", field.dimensions(), coordSys_.R().R());
if (obr_.foundObject<Type>(fieldName))
if (!obr_.foundObject<Type>(fieldName))
{
Type& transField =
const_cast<Type&>(obr_.lookupObject<Type>(fieldName));
transField == field;
forAll(field, i)
{
Foam::transform(transField, R, transField);
}
transField.write();
}
else
{
Type& transField = obr_.store
obr_.store
(
new Type
(
@ -72,14 +56,23 @@ void Foam::fieldCoordinateSystemTransform::transformField
field
)
);
forAll(field, i)
{
Foam::transform(transField, R, transField);
}
transField.write();
}
Type& transField =
const_cast<Type&>(obr_.lookupObject<Type>(fieldName));
transField == field;
dimensionedTensor R("R", field.dimensions(), coordSys_.R().R());
forAll(field, i)
{
Foam::transform(transField, R, transField);
}
Info<< " writing field " << transField.name() << nl << endl;
transField.write();
}