Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
28359c53
Commit
28359c53
authored
May 22, 2016
by
Henry Weller
Browse files
functionObjects/field/fieldCoordinateSystemTransform: simplified, standardized, rationalized
parent
43110ffd
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/postProcessing/functionObjects/field/fieldCoordinateSystemTransform/fieldCoordinateSystemTransform.C
View file @
28359c53
...
...
@@ -24,7 +24,6 @@ License
\*---------------------------------------------------------------------------*/
#include "fieldCoordinateSystemTransform.H"
#include "dictionary.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
...
...
@@ -55,23 +54,10 @@ fieldCoordinateSystemTransform
const
dictionary
&
dict
)
:
functionObject
(
name
),
obr_
(
runTime
.
lookupObject
<
objectRegistry
>
(
dict
.
lookupOrDefault
(
"region"
,
polyMesh
::
defaultRegion
)
)
),
fvMeshFunctionObject
(
name
,
runTime
,
dict
),
fieldSet_
(),
coordSys_
(
obr
_
,
dict
)
coordSys_
(
mesh
_
,
dict
)
{
if
(
!
isA
<
fvMesh
>
(
obr_
))
{
FatalErrorInFunction
<<
"objectRegistry is not an fvMesh"
<<
exit
(
FatalError
);
}
read
(
dict
);
Info
<<
type
()
<<
" "
<<
name
<<
":"
<<
nl
...
...
@@ -89,6 +75,16 @@ Foam::functionObjects::fieldCoordinateSystemTransform::
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam
::
word
Foam
::
functionObjects
::
fieldCoordinateSystemTransform
::
transformFieldName
(
const
word
&
fieldName
)
const
{
return
fieldName
+
":Transformed"
;
}
bool
Foam
::
functionObjects
::
fieldCoordinateSystemTransform
::
read
(
const
dictionary
&
dict
...
...
@@ -105,11 +101,8 @@ bool Foam::functionObjects::fieldCoordinateSystemTransform::execute
const
bool
postProcess
)
{
Info
<<
type
()
<<
" "
<<
name
()
<<
" output:"
<<
nl
;
forAll
(
fieldSet_
,
fieldi
)
{
// If necessary load field
transform
<
scalar
>
(
fieldSet_
[
fieldi
]);
transform
<
vector
>
(
fieldSet_
[
fieldi
]);
transform
<
sphericalTensor
>
(
fieldSet_
[
fieldi
]);
...
...
@@ -126,22 +119,11 @@ bool Foam::functionObjects::fieldCoordinateSystemTransform::write
const
bool
postProcess
)
{
Info
<<
type
()
<<
" "
<<
name
()
<<
" output:"
<<
nl
;
forAll
(
fieldSet_
,
fieldi
)
{
const
word
fieldName
=
fieldSet_
[
fieldi
]
+
":Transformed"
;
const
regIOobject
&
field
=
obr_
.
lookupObject
<
regIOobject
>
(
fieldName
);
Info
<<
" writing field "
<<
field
.
name
()
<<
nl
;
field
.
write
();
fvMeshFunctionObject
::
write
(
transformFieldName
(
fieldSet_
[
fieldi
]));
}
Info
<<
endl
;
return
true
;
}
...
...
src/postProcessing/functionObjects/field/fieldCoordinateSystemTransform/fieldCoordinateSystemTransform.H
View file @
28359c53
...
...
@@ -63,7 +63,7 @@ Description
\endtable
SeeAlso
Foam::functionObject
Foam::functionObject
s::fvMeshFunctionObject
Foam::coordinateSystem
SourceFiles
...
...
@@ -75,8 +75,7 @@ SourceFiles
#ifndef functionObjects_fieldCoordinateSystemTransform_H
#define functionObjects_fieldCoordinateSystemTransform_H
#include "functionObject.H"
#include "volFieldsFwd.H"
#include "fvMeshFunctionObject.H"
#include "coordinateSystem.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
@@ -96,15 +95,12 @@ namespace functionObjects
class
fieldCoordinateSystemTransform
:
public
functionObject
public
f
vMeshF
unctionObject
{
protected:
// Protected data
//- Reference to the objectRegistry
const
objectRegistry
&
obr_
;
//- Fields to transform
wordList
fieldSet_
;
...
...
@@ -114,22 +110,16 @@ protected:
// Protected Member Functions
template
<
class
Type
>
void
transform
(
const
word
&
fieldName
)
const
;
template
<
class
Type
>
void
transformField
(
const
Type
&
field
)
const
;
private:
//- Return the name of the transformed field
word
transformFieldName
(
const
word
&
fieldName
)
const
;
// Private member functions
//- Transform the given field
template
<
class
FieldType
>
void
transformField
(
const
FieldType
&
field
);
//- Disallow default bitwise copy construct
fieldCoordinateSystemTransform
(
const
fieldCoordinateSystemTransform
&
);
//- Disallow default bitwise assignment
void
operator
=
(
const
fieldCoordinateSystemTransform
&
);
//- Transform the given field if has the specified element type
template
<
class
Type
>
void
transform
(
const
word
&
fieldName
);
public:
...
...
src/postProcessing/functionObjects/field/fieldCoordinateSystemTransform/fieldCoordinateSystemTransformTemplates.C
View file @
28359c53
...
...
@@ -26,50 +26,23 @@ License
#include "fieldCoordinateSystemTransform.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "Time.H"
#include "transformGeometricField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template
<
class
Type
>
template
<
class
Field
Type
>
void
Foam
::
functionObjects
::
fieldCoordinateSystemTransform
::
transformField
(
const
Type
&
field
)
const
const
Field
Type
&
field
)
{
const
word
&
fieldName
=
field
.
name
()
+
":Transformed"
;
if
(
!
obr_
.
foundObject
<
Type
>
(
fieldName
))
{
obr_
.
store
(
new
Type
(
IOobject
(
fieldName
,
obr_
.
time
().
timeName
(),
obr_
,
IOobject
::
READ_IF_PRESENT
,
IOobject
::
NO_WRITE
),
field
)
);
}
Type
&
transField
=
const_cast
<
Type
&>
(
obr_
.
lookupObject
<
Type
>
(
fieldName
));
transField
==
field
;
word
transFieldName
(
transformFieldName
(
field
.
name
()));
dimensionedTensor
R
(
"R"
,
field
.
dimensions
(),
coordSys_
.
R
().
R
());
Foam
::
transform
(
transField
,
R
,
transField
);
Info
<<
" writing field "
<<
transField
.
name
()
<<
nl
<<
endl
;
transField
.
write
();
store
(
transFieldName
,
Foam
::
transform
(
dimensionedTensor
(
coordSys_
.
R
().
R
()),
field
)
);
}
...
...
@@ -77,12 +50,12 @@ template<class Type>
void
Foam
::
functionObjects
::
fieldCoordinateSystemTransform
::
transform
(
const
word
&
fieldName
)
const
)
{
typedef
GeometricField
<
Type
,
fvPatchField
,
volMesh
>
vf
Type
;
typedef
GeometricField
<
Type
,
fvsPatchField
,
surfaceMesh
>
sf
Type
;
typedef
GeometricField
<
Type
,
fvPatchField
,
volMesh
>
VolField
Type
;
typedef
GeometricField
<
Type
,
fvsPatchField
,
surfaceMesh
>
SurfaceField
Type
;
if
(
obr
_
.
foundObject
<
vf
Type
>
(
fieldName
))
if
(
mesh
_
.
foundObject
<
VolField
Type
>
(
fieldName
))
{
if
(
debug
)
{
...
...
@@ -90,9 +63,12 @@ void Foam::functionObjects::fieldCoordinateSystemTransform::transform
<<
endl
;
}
transformField
<
vfType
>
(
obr_
.
lookupObject
<
vfType
>
(
fieldName
));
transformField
<
VolFieldType
>
(
mesh_
.
lookupObject
<
VolFieldType
>
(
fieldName
)
);
}
else
if
(
obr
_
.
foundObject
<
sf
Type
>
(
fieldName
))
else
if
(
mesh
_
.
foundObject
<
SurfaceField
Type
>
(
fieldName
))
{
if
(
debug
)
{
...
...
@@ -100,15 +76,18 @@ void Foam::functionObjects::fieldCoordinateSystemTransform::transform
<<
endl
;
}
transformField
<
sfType
>
(
obr_
.
lookupObject
<
sfType
>
(
fieldName
));
transformField
<
SurfaceFieldType
>
(
mesh_
.
lookupObject
<
SurfaceFieldType
>
(
fieldName
)
);
}
else
{
IOobject
fieldHeader
(
fieldName
,
obr
_
.
time
().
timeName
(),
obr
_
,
mesh
_
.
time
().
timeName
(),
mesh
_
,
IOobject
::
MUST_READ
,
IOobject
::
NO_WRITE
);
...
...
@@ -116,7 +95,7 @@ void Foam::functionObjects::fieldCoordinateSystemTransform::transform
if
(
fieldHeader
.
headerOk
()
&&
fieldHeader
.
headerClassName
()
==
vf
Type
::
typeName
&&
fieldHeader
.
headerClassName
()
==
VolField
Type
::
typeName
)
{
if
(
debug
)
...
...
@@ -125,12 +104,15 @@ void Foam::functionObjects::fieldCoordinateSystemTransform::transform
<<
endl
;
}
transformField
<
vfType
>
(
obr_
.
lookupObject
<
vfType
>
(
fieldName
));
transformField
<
VolFieldType
>
(
mesh_
.
lookupObject
<
VolFieldType
>
(
fieldName
)
);
}
else
if
(
fieldHeader
.
headerOk
()
&&
fieldHeader
.
headerClassName
()
==
sf
Type
::
typeName
&&
fieldHeader
.
headerClassName
()
==
SurfaceField
Type
::
typeName
)
{
if
(
debug
)
...
...
@@ -139,7 +121,10 @@ void Foam::functionObjects::fieldCoordinateSystemTransform::transform
<<
endl
;
}
transformField
<
sfType
>
(
obr_
.
lookupObject
<
sfType
>
(
fieldName
));
transformField
<
SurfaceFieldType
>
(
mesh_
.
lookupObject
<
SurfaceFieldType
>
(
fieldName
)
);
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment