mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -27,6 +27,7 @@ setFormat raw;
|
|||||||
|
|
||||||
// Surface output format. Choice of
|
// Surface output format. Choice of
|
||||||
// null : suppress output
|
// null : suppress output
|
||||||
|
// ensight : Ensight Gold format, one field per case file
|
||||||
// foamFile : separate points, faces and values file
|
// foamFile : separate points, faces and values file
|
||||||
// dx : DX scalar or vector format
|
// dx : DX scalar or vector format
|
||||||
// vtk : VTK ascii format
|
// vtk : VTK ascii format
|
||||||
|
|||||||
@ -20,4 +20,7 @@ streamLine/streamLineParticle.C
|
|||||||
streamLine/streamLineParticleCloud.C
|
streamLine/streamLineParticleCloud.C
|
||||||
streamLine/streamLineFunctionObject.C
|
streamLine/streamLineFunctionObject.C
|
||||||
|
|
||||||
|
surfaceInterpolateFields/surfaceInterpolateFields.C
|
||||||
|
surfaceInterpolateFields/surfaceInterpolateFieldsFunctionObject.C
|
||||||
|
|
||||||
LIB = $(FOAM_LIBBIN)/libfieldFunctionObjects
|
LIB = $(FOAM_LIBBIN)/libfieldFunctionObjects
|
||||||
|
|||||||
@ -198,11 +198,10 @@ void Foam::fieldValues::cellSource::write()
|
|||||||
|
|
||||||
if (active_)
|
if (active_)
|
||||||
{
|
{
|
||||||
|
scalar totalVolume = gSum(filterField(mesh().V()));
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
outputFilePtr_()
|
outputFilePtr_() << obr_.time().value() << tab << totalVolume;
|
||||||
<< obr_.time().value() << tab
|
|
||||||
<< sum(filterField(mesh().V()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(fields_, i)
|
forAll(fields_, i)
|
||||||
|
|||||||
@ -61,11 +61,25 @@ functions
|
|||||||
// Output field values as well
|
// Output field values as well
|
||||||
valueOutput true;
|
valueOutput true;
|
||||||
|
|
||||||
// Patch or faceZone to sample
|
// Type of source: patch/faceZone/sampledSurface
|
||||||
source patch;
|
source patch;
|
||||||
|
|
||||||
|
// if patch or faceZone: name of patch or faceZone
|
||||||
sourceName movingWall;
|
sourceName movingWall;
|
||||||
// source faceZone;
|
|
||||||
// sourceName f0;
|
//// if sampledSurface: dictionary with a sampledSurface
|
||||||
|
//// Note: the sampledSurfaces will have cell-values, i.e.
|
||||||
|
//// non-interpolated. Also will not sample surface fields.
|
||||||
|
//sampledSurfaceDict
|
||||||
|
//{
|
||||||
|
// type cuttingPlane;
|
||||||
|
// planeType pointAndNormal;
|
||||||
|
// pointAndNormalDict
|
||||||
|
// {
|
||||||
|
// basePoint (0 0.099 0);
|
||||||
|
// normalVector (0 1 0);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
// Operation: areaAverage/sum/weightedAverage ...
|
// Operation: areaAverage/sum/weightedAverage ...
|
||||||
operation areaAverage;
|
operation areaAverage;
|
||||||
@ -73,7 +87,7 @@ functions
|
|||||||
fields
|
fields
|
||||||
(
|
(
|
||||||
p
|
p
|
||||||
phi
|
phi // surface fields not supported for sampledSurface
|
||||||
U
|
U
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,21 +28,20 @@ License
|
|||||||
#include "cyclicPolyPatch.H"
|
#include "cyclicPolyPatch.H"
|
||||||
#include "emptyPolyPatch.H"
|
#include "emptyPolyPatch.H"
|
||||||
#include "coupledPolyPatch.H"
|
#include "coupledPolyPatch.H"
|
||||||
#include "surfaceFields.H"
|
#include "sampledSurface.H"
|
||||||
#include "volFields.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
defineTypeNameAndDebug(Foam::fieldValues::faceSource, 0);
|
defineTypeNameAndDebug(Foam::fieldValues::faceSource, 0);
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
const char* Foam::NamedEnum<Foam::fieldValues::faceSource::sourceType, 2>::
|
const char* Foam::NamedEnum<Foam::fieldValues::faceSource::sourceType, 3>::
|
||||||
names[] =
|
names[] =
|
||||||
{
|
{
|
||||||
"faceZone", "patch"
|
"faceZone", "patch", "sampledSurface"
|
||||||
};
|
};
|
||||||
|
|
||||||
const Foam::NamedEnum<Foam::fieldValues::faceSource::sourceType, 2>
|
const Foam::NamedEnum<Foam::fieldValues::faceSource::sourceType, 3>
|
||||||
Foam::fieldValues::faceSource::sourceTypeNames_;
|
Foam::fieldValues::faceSource::sourceTypeNames_;
|
||||||
|
|
||||||
|
|
||||||
@ -188,6 +187,19 @@ void Foam::fieldValues::faceSource::setPatchFaces()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::fieldValues::faceSource::sampledSurfaceFaces(const dictionary& dict)
|
||||||
|
{
|
||||||
|
surfacePtr_ = sampledSurface::New
|
||||||
|
(
|
||||||
|
name_,
|
||||||
|
mesh(),
|
||||||
|
dict.subDict("sampledSurfaceDict")
|
||||||
|
);
|
||||||
|
surfacePtr_().update();
|
||||||
|
nFaces_ = returnReduce(surfacePtr_().faces().size(), sumOp<label>());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::fieldValues::faceSource::initialise(const dictionary& dict)
|
void Foam::fieldValues::faceSource::initialise(const dictionary& dict)
|
||||||
@ -204,20 +216,37 @@ void Foam::fieldValues::faceSource::initialise(const dictionary& dict)
|
|||||||
setPatchFaces();
|
setPatchFaces();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case stSampledSurface:
|
||||||
|
{
|
||||||
|
sampledSurfaceFaces(dict);
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
FatalErrorIn("faceSource::initialise()")
|
FatalErrorIn("faceSource::initialise()")
|
||||||
<< type() << " " << name_ << ": "
|
<< type() << " " << name_ << ": "
|
||||||
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):"
|
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):"
|
||||||
<< nl << " Unknown source type. Valid source types are:"
|
<< nl << " Unknown source type. Valid source types are:"
|
||||||
<< sourceTypeNames_ << nl << exit(FatalError);
|
<< sourceTypeNames_.sortedToc() << nl << exit(FatalError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
scalar totalArea;
|
||||||
|
|
||||||
|
if (surfacePtr_.valid())
|
||||||
|
{
|
||||||
|
surfacePtr_().update();
|
||||||
|
totalArea = gSum(surfacePtr_().magSf());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
totalArea = gSum(filterField(mesh().magSf(), false));
|
||||||
|
}
|
||||||
|
|
||||||
Info<< type() << " " << name_ << ":" << nl
|
Info<< type() << " " << name_ << ":" << nl
|
||||||
<< " total faces = " << nFaces_
|
<< " total faces = " << nFaces_
|
||||||
<< nl
|
<< nl
|
||||||
<< " total area = " << gSum(filterField(mesh().magSf(), false))
|
<< " total area = " << totalArea
|
||||||
<< nl;
|
<< nl;
|
||||||
|
|
||||||
if (operation_ == opWeightedAverage)
|
if (operation_ == opWeightedAverage)
|
||||||
@ -280,11 +309,11 @@ Foam::fieldValues::faceSource::faceSource
|
|||||||
fieldValue(name, obr, dict, loadFromFiles),
|
fieldValue(name, obr, dict, loadFromFiles),
|
||||||
source_(sourceTypeNames_.read(dict.lookup("source"))),
|
source_(sourceTypeNames_.read(dict.lookup("source"))),
|
||||||
operation_(operationTypeNames_.read(dict.lookup("operation"))),
|
operation_(operationTypeNames_.read(dict.lookup("operation"))),
|
||||||
|
weightFieldName_("undefinedWeightedFieldName"),
|
||||||
nFaces_(0),
|
nFaces_(0),
|
||||||
faceId_(),
|
faceId_(),
|
||||||
facePatchId_(),
|
facePatchId_(),
|
||||||
faceSign_(),
|
faceSign_()
|
||||||
weightFieldName_("undefinedWeightedFieldName")
|
|
||||||
{
|
{
|
||||||
read(dict);
|
read(dict);
|
||||||
}
|
}
|
||||||
@ -315,11 +344,22 @@ void Foam::fieldValues::faceSource::write()
|
|||||||
|
|
||||||
if (active_)
|
if (active_)
|
||||||
{
|
{
|
||||||
|
scalar totalArea;
|
||||||
|
|
||||||
|
if (surfacePtr_.valid())
|
||||||
|
{
|
||||||
|
surfacePtr_().update();
|
||||||
|
totalArea = gSum(surfacePtr_().magSf());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
totalArea = gSum(filterField(mesh().magSf(), false));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
outputFilePtr_()
|
outputFilePtr_() << obr_.time().value() << tab << totalArea;
|
||||||
<< obr_.time().value() << tab
|
|
||||||
<< sum(filterField(mesh().magSf(), false));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(fields_, i)
|
forAll(fields_, i)
|
||||||
|
|||||||
@ -36,8 +36,9 @@ Description
|
|||||||
outputControl outputTime;
|
outputControl outputTime;
|
||||||
log true; // log to screen?
|
log true; // log to screen?
|
||||||
valueOutput true; // Write values at run-time output times?
|
valueOutput true; // Write values at run-time output times?
|
||||||
source faceZone; // Type of face source: faceZone, patch
|
source faceZone; // Type of face source:
|
||||||
sourceName f0;
|
// faceZone,patch,sampledSurface
|
||||||
|
sourceName f0; // faceZone name, see below
|
||||||
operation sum;
|
operation sum;
|
||||||
fields
|
fields
|
||||||
(
|
(
|
||||||
@ -47,7 +48,13 @@ Description
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
where operation is one of:
|
source:
|
||||||
|
- faceZone : requires a 'sourceName' entry to specify the faceZone
|
||||||
|
- patch : "" patch
|
||||||
|
- sampledSurface : requires a 'sampledSurfaceDict' subdictionary. See e.g.
|
||||||
|
sampleDict.
|
||||||
|
|
||||||
|
operation is one of:
|
||||||
- none
|
- none
|
||||||
- sum
|
- sum
|
||||||
- areaAverage
|
- areaAverage
|
||||||
@ -62,6 +69,11 @@ Description
|
|||||||
faces.
|
faces.
|
||||||
- all fields get oriented according to the faceZone (so you might e.g. see
|
- all fields get oriented according to the faceZone (so you might e.g. see
|
||||||
negative pressure)
|
negative pressure)
|
||||||
|
- using sampledSurfaces:
|
||||||
|
- they do not do surface fields
|
||||||
|
- they use cell values - they do not do any interpolation.
|
||||||
|
- take care when using isoSurfaces - these might have duplicate
|
||||||
|
triangles so integration might be wrong
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
faceSource.C
|
faceSource.C
|
||||||
@ -80,6 +92,9 @@ SourceFiles
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
|
class sampledSurface;
|
||||||
|
|
||||||
namespace fieldValues
|
namespace fieldValues
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -100,11 +115,12 @@ public:
|
|||||||
enum sourceType
|
enum sourceType
|
||||||
{
|
{
|
||||||
stFaceZone,
|
stFaceZone,
|
||||||
stPatch
|
stPatch,
|
||||||
|
stSampledSurface
|
||||||
};
|
};
|
||||||
|
|
||||||
//- Source type names
|
//- Source type names
|
||||||
static const NamedEnum<sourceType, 2> sourceTypeNames_;
|
static const NamedEnum<sourceType, 3> sourceTypeNames_;
|
||||||
|
|
||||||
|
|
||||||
//- Operation type enumeration
|
//- Operation type enumeration
|
||||||
@ -133,6 +149,9 @@ private:
|
|||||||
//- Set faces to evaluate based on a patch
|
//- Set faces to evaluate based on a patch
|
||||||
void setPatchFaces();
|
void setPatchFaces();
|
||||||
|
|
||||||
|
//- Set faces according to sampledSurface
|
||||||
|
void sampledSurfaceFaces(const dictionary&);
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@ -144,20 +163,30 @@ protected:
|
|||||||
//- Operation to apply to values
|
//- Operation to apply to values
|
||||||
operationType operation_;
|
operationType operation_;
|
||||||
|
|
||||||
|
//- Weight field name - only used for opWeightedAverage mode
|
||||||
|
word weightFieldName_;
|
||||||
|
|
||||||
//- Global number of faces
|
//- Global number of faces
|
||||||
label nFaces_;
|
label nFaces_;
|
||||||
|
|
||||||
//- Local list of face IDs
|
|
||||||
labelList faceId_;
|
|
||||||
|
|
||||||
//- Local list of patch ID per face
|
// If operating on mesh faces (faceZone,patch)
|
||||||
labelList facePatchId_;
|
|
||||||
|
|
||||||
//- List of +1/-1 representing face flip map (1 use as is, -1 negate)
|
//- Local list of face IDs
|
||||||
labelList faceSign_;
|
labelList faceId_;
|
||||||
|
|
||||||
|
//- Local list of patch ID per face
|
||||||
|
labelList facePatchId_;
|
||||||
|
|
||||||
|
//- List of +1/-1 representing face flip map
|
||||||
|
// (1 use as is, -1 negate)
|
||||||
|
labelList faceSign_;
|
||||||
|
|
||||||
|
// If operating on sampledSurface
|
||||||
|
|
||||||
|
//- underlying sampledSurface
|
||||||
|
autoPtr<sampledSurface> surfacePtr_;
|
||||||
|
|
||||||
//- Weight field name - only used for opWeightedAverage mode
|
|
||||||
word weightFieldName_;
|
|
||||||
|
|
||||||
|
|
||||||
// Protected Member Functions
|
// Protected Member Functions
|
||||||
@ -171,7 +200,7 @@ protected:
|
|||||||
|
|
||||||
//- Return field values by looking up field name
|
//- Return field values by looking up field name
|
||||||
template<class Type>
|
template<class Type>
|
||||||
tmp<Field<Type> > setFieldValues(const word& fieldName) const;
|
tmp<Field<Type> > getFieldValues(const word& fieldName) const;
|
||||||
|
|
||||||
//- Apply the 'operation' to the values
|
//- Apply the 'operation' to the values
|
||||||
template<class Type>
|
template<class Type>
|
||||||
|
|||||||
@ -26,7 +26,7 @@ License
|
|||||||
#include "faceSource.H"
|
#include "faceSource.H"
|
||||||
#include "surfaceFields.H"
|
#include "surfaceFields.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
#include "ListListOps.H"
|
#include "sampledSurface.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ bool Foam::fieldValues::faceSource::validField(const word& fieldName) const
|
|||||||
typedef GeometricField<Type, fvsPatchField, surfaceMesh> sf;
|
typedef GeometricField<Type, fvsPatchField, surfaceMesh> sf;
|
||||||
typedef GeometricField<Type, fvPatchField, volMesh> vf;
|
typedef GeometricField<Type, fvPatchField, volMesh> vf;
|
||||||
|
|
||||||
if (obr_.foundObject<sf>(fieldName))
|
if (source_ != stSampledSurface && obr_.foundObject<sf>(fieldName))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -50,7 +50,7 @@ bool Foam::fieldValues::faceSource::validField(const word& fieldName) const
|
|||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::tmp<Foam::Field<Type> > Foam::fieldValues::faceSource::setFieldValues
|
Foam::tmp<Foam::Field<Type> > Foam::fieldValues::faceSource::getFieldValues
|
||||||
(
|
(
|
||||||
const word& fieldName
|
const word& fieldName
|
||||||
) const
|
) const
|
||||||
@ -58,13 +58,20 @@ Foam::tmp<Foam::Field<Type> > Foam::fieldValues::faceSource::setFieldValues
|
|||||||
typedef GeometricField<Type, fvsPatchField, surfaceMesh> sf;
|
typedef GeometricField<Type, fvsPatchField, surfaceMesh> sf;
|
||||||
typedef GeometricField<Type, fvPatchField, volMesh> vf;
|
typedef GeometricField<Type, fvPatchField, volMesh> vf;
|
||||||
|
|
||||||
if (obr_.foundObject<sf>(fieldName))
|
if (source_ != stSampledSurface && obr_.foundObject<sf>(fieldName))
|
||||||
{
|
{
|
||||||
return filterField(obr_.lookupObject<sf>(fieldName), true);
|
return filterField(obr_.lookupObject<sf>(fieldName), true);
|
||||||
}
|
}
|
||||||
else if (obr_.foundObject<vf>(fieldName))
|
else if (obr_.foundObject<vf>(fieldName))
|
||||||
{
|
{
|
||||||
return filterField(obr_.lookupObject<vf>(fieldName), true);
|
if (surfacePtr_.valid())
|
||||||
|
{
|
||||||
|
return surfacePtr_().sample(obr_.lookupObject<vf>(fieldName));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return filterField(obr_.lookupObject<vf>(fieldName), true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return tmp<Field<Type> >(new Field<Type>(0));
|
return tmp<Field<Type> >(new Field<Type>(0));
|
||||||
@ -131,15 +138,26 @@ bool Foam::fieldValues::faceSource::writeValues(const word& fieldName)
|
|||||||
|
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
// Get (correctly oriented) field
|
Field<Type> values = getFieldValues<Type>(fieldName);
|
||||||
Field<Type> values = combineFields(setFieldValues<Type>(fieldName));
|
scalarField weightField = getFieldValues<scalar>(weightFieldName_);
|
||||||
|
scalarField magSf;
|
||||||
|
|
||||||
// Get unoriented magSf
|
if (surfacePtr_.valid())
|
||||||
scalarField magSf = combineFields(filterField(mesh().magSf(), false));
|
{
|
||||||
|
// Get unoriented magSf
|
||||||
|
magSf = surfacePtr_().magSf();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Get unoriented magSf
|
||||||
|
magSf = combineFields(filterField(mesh().magSf(), false));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Combine onto master
|
||||||
|
values = combineFields(values);
|
||||||
|
magSf = combineFields(magSf);
|
||||||
|
weightField = combineFields(weightField);
|
||||||
|
|
||||||
// Get (correctly oriented) weighting field
|
|
||||||
scalarField weightField =
|
|
||||||
combineFields(setFieldValues<scalar>(weightFieldName_));
|
|
||||||
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -130,7 +130,7 @@ Foam::fieldValue::fieldValue
|
|||||||
obr_(obr),
|
obr_(obr),
|
||||||
active_(true),
|
active_(true),
|
||||||
log_(false),
|
log_(false),
|
||||||
sourceName_(dict.lookup("sourceName")),
|
sourceName_(dict.lookupOrDefault<word>("sourceName", "sampledSurface")),
|
||||||
fields_(dict.lookup("fields")),
|
fields_(dict.lookup("fields")),
|
||||||
valueOutput_(dict.lookup("valueOutput")),
|
valueOutput_(dict.lookup("valueOutput")),
|
||||||
outputFilePtr_(NULL)
|
outputFilePtr_(NULL)
|
||||||
|
|||||||
@ -164,12 +164,14 @@ public:
|
|||||||
//- Execute the at the final time-loop, currently does nothing
|
//- Execute the at the final time-loop, currently does nothing
|
||||||
virtual void end();
|
virtual void end();
|
||||||
|
|
||||||
//- Comnbine fields from all processor domains into single field
|
//- Combine fields from all processor domains into single field
|
||||||
template<class Type>
|
template<class Type>
|
||||||
tmp<Field<Type> > combineFields
|
tmp<Field<Type> > combineFields(const Field<Type>& field) const;
|
||||||
(
|
|
||||||
const tmp<Field<Type> >& field
|
//- Combine fields from all processor domains into single field
|
||||||
) const;
|
template<class Type>
|
||||||
|
tmp<Field<Type> > combineFields(const tmp<Field<Type> >&) const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -32,12 +32,12 @@ License
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::tmp<Foam::Field<Type> > Foam::fieldValue::combineFields
|
Foam::tmp<Foam::Field<Type> > Foam::fieldValue::combineFields
|
||||||
(
|
(
|
||||||
const tmp<Field<Type> >& field
|
const Field<Type>& field
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
List<Field<Type> > allValues(Pstream::nProcs());
|
List<Field<Type> > allValues(Pstream::nProcs());
|
||||||
|
|
||||||
allValues[Pstream::myProcNo()] = field();
|
allValues[Pstream::myProcNo()] = field;
|
||||||
|
|
||||||
Pstream::gatherList(allValues);
|
Pstream::gatherList(allValues);
|
||||||
|
|
||||||
@ -57,9 +57,19 @@ Foam::tmp<Foam::Field<Type> > Foam::fieldValue::combineFields
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return field();
|
return field;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::tmp<Foam::Field<Type> > Foam::fieldValue::combineFields
|
||||||
|
(
|
||||||
|
const tmp<Field<Type> >& field
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return combineFields(field());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -46,6 +46,7 @@ surfWriters = sampledSurface/writers
|
|||||||
|
|
||||||
$(surfWriters)/surfaceWriters.C
|
$(surfWriters)/surfaceWriters.C
|
||||||
$(surfWriters)/dx/dxSurfaceWriterRunTime.C
|
$(surfWriters)/dx/dxSurfaceWriterRunTime.C
|
||||||
|
$(surfWriters)/ensight/ensightSurfaceWriterRunTime.C
|
||||||
$(surfWriters)/foamFile/foamFileSurfaceWriterRunTime.C
|
$(surfWriters)/foamFile/foamFileSurfaceWriterRunTime.C
|
||||||
$(surfWriters)/null/nullSurfaceWriterRunTime.C
|
$(surfWriters)/null/nullSurfaceWriterRunTime.C
|
||||||
$(surfWriters)/proxy/proxySurfaceWriterRunTime.C
|
$(surfWriters)/proxy/proxySurfaceWriterRunTime.C
|
||||||
|
|||||||
@ -103,7 +103,8 @@ void Foam::sampledSurfaces::sampleAndWrite
|
|||||||
mergeList_[surfI].points,
|
mergeList_[surfI].points,
|
||||||
mergeList_[surfI].faces,
|
mergeList_[surfI].faces,
|
||||||
fieldName,
|
fieldName,
|
||||||
allValues
|
allValues,
|
||||||
|
s.interpolate()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -121,7 +122,8 @@ void Foam::sampledSurfaces::sampleAndWrite
|
|||||||
s.points(),
|
s.points(),
|
||||||
s.faces(),
|
s.faces(),
|
||||||
fieldName,
|
fieldName,
|
||||||
values
|
values,
|
||||||
|
s.interpolate()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -250,6 +250,7 @@ void Foam::dxSurfaceWriter<Type>::write
|
|||||||
const faceList& faces,
|
const faceList& faces,
|
||||||
const word& fieldName,
|
const word& fieldName,
|
||||||
const Field<Type>& values,
|
const Field<Type>& values,
|
||||||
|
const bool isNodeValues,
|
||||||
const bool verbose
|
const bool verbose
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
@ -272,7 +273,7 @@ void Foam::dxSurfaceWriter<Type>::write
|
|||||||
|
|
||||||
writeData(os, values);
|
writeData(os, values);
|
||||||
|
|
||||||
if (values.size() == points.size())
|
if (isNodeValues)
|
||||||
{
|
{
|
||||||
os << nl << "attribute \"dep\" string \"positions\""
|
os << nl << "attribute \"dep\" string \"positions\""
|
||||||
<< nl << nl;
|
<< nl << nl;
|
||||||
|
|||||||
@ -88,6 +88,7 @@ public:
|
|||||||
const faceList& faces,
|
const faceList& faces,
|
||||||
const word& fieldName,
|
const word& fieldName,
|
||||||
const Field<Type>& values,
|
const Field<Type>& values,
|
||||||
|
const bool isNodeValues,
|
||||||
const bool verbose = false
|
const bool verbose = false
|
||||||
) const;
|
) const;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -0,0 +1,372 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "ensightSurfaceWriter.H"
|
||||||
|
|
||||||
|
#include "OFstream.H"
|
||||||
|
#include "OSspecific.H"
|
||||||
|
#include "IOmanip.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::ensightSurfaceWriter<Type>::binShapes
|
||||||
|
(
|
||||||
|
const pointField& points,
|
||||||
|
const faceList& faces,
|
||||||
|
DynamicList<label>& tris,
|
||||||
|
DynamicList<label>& quads,
|
||||||
|
DynamicList<label>& polys
|
||||||
|
)
|
||||||
|
{
|
||||||
|
tris.setCapacity(faces.size());
|
||||||
|
quads.setCapacity(faces.size());
|
||||||
|
polys.setCapacity(faces.size());
|
||||||
|
|
||||||
|
forAll(faces, i)
|
||||||
|
{
|
||||||
|
const face& f = faces[i];
|
||||||
|
if (f.size() == 3)
|
||||||
|
{
|
||||||
|
tris.append(i);
|
||||||
|
}
|
||||||
|
else if (f.size() == 4)
|
||||||
|
{
|
||||||
|
quads.append(i);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
polys.append(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::ensightSurfaceWriter<Type>::writeGeometry
|
||||||
|
(
|
||||||
|
const fileName& surfaceName,
|
||||||
|
Ostream& os,
|
||||||
|
const pointField& points,
|
||||||
|
const faceList& faces,
|
||||||
|
const DynamicList<label>& tris,
|
||||||
|
const DynamicList<label>& quads,
|
||||||
|
const DynamicList<label>& polys
|
||||||
|
)
|
||||||
|
{
|
||||||
|
os << "EnSight Geometry File" << nl
|
||||||
|
<< (string("written by OpenFOAM-") + Foam::FOAMversion).c_str() << nl
|
||||||
|
<< "node id assign" << nl
|
||||||
|
<< "element id assign" << nl
|
||||||
|
<< "part" << nl
|
||||||
|
<< setw(10) << 1 << nl
|
||||||
|
<< surfaceName.c_str() << nl;
|
||||||
|
|
||||||
|
os << "coordinates" << nl
|
||||||
|
<< setw(10) << points.size() << nl;
|
||||||
|
for (direction cmpt = 0; cmpt < vector::nComponents; cmpt++)
|
||||||
|
{
|
||||||
|
scalarField v = points.component(cmpt);
|
||||||
|
forAll(v, i)
|
||||||
|
{
|
||||||
|
os << v[i] << nl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (tris.size())
|
||||||
|
{
|
||||||
|
os << "tria3" << nl
|
||||||
|
<< setw(10) << tris.size() << nl;
|
||||||
|
forAll(tris, i)
|
||||||
|
{
|
||||||
|
const face& f = faces[tris[i]];
|
||||||
|
forAll(f, fp)
|
||||||
|
{
|
||||||
|
os << setw(10) << f[fp]+1;
|
||||||
|
}
|
||||||
|
os << nl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (quads.size())
|
||||||
|
{
|
||||||
|
os << "quad4" << nl
|
||||||
|
<< setw(10) << quads.size() << nl;
|
||||||
|
forAll(quads, i)
|
||||||
|
{
|
||||||
|
const face& f = faces[quads[i]];
|
||||||
|
forAll(f, fp)
|
||||||
|
{
|
||||||
|
os << setw(10) << f[fp]+1;
|
||||||
|
}
|
||||||
|
os << nl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (polys.size())
|
||||||
|
{
|
||||||
|
os << "nsided" << nl
|
||||||
|
<< setw(10) << polys.size() << nl;
|
||||||
|
forAll(polys, i)
|
||||||
|
{
|
||||||
|
const face& f = faces[polys[i]];
|
||||||
|
forAll(f, fp)
|
||||||
|
{
|
||||||
|
os << setw(10) << f[fp]+1;
|
||||||
|
}
|
||||||
|
os << nl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// Write scalarField in ensight format
|
||||||
|
template<>
|
||||||
|
void Foam::ensightSurfaceWriter<Foam::scalar>::writeData
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const Field<Foam::scalar>& values
|
||||||
|
)
|
||||||
|
{
|
||||||
|
forAll(values, i)
|
||||||
|
{
|
||||||
|
os << values[i] << nl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Write booField in ensight format
|
||||||
|
template<>
|
||||||
|
void Foam::ensightSurfaceWriter<bool>::writeData
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const Field<bool>& values
|
||||||
|
)
|
||||||
|
{
|
||||||
|
forAll(values, i)
|
||||||
|
{
|
||||||
|
os << values[i] << nl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Write generic field in ensight format
|
||||||
|
template<class Type>
|
||||||
|
void Foam::ensightSurfaceWriter<Type>::writeData
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const Field<Type>& values
|
||||||
|
)
|
||||||
|
{
|
||||||
|
for (direction cmpt = 0; cmpt < vector::nComponents; cmpt++)
|
||||||
|
{
|
||||||
|
scalarField v = values.component(cmpt);
|
||||||
|
forAll(v, i)
|
||||||
|
{
|
||||||
|
os << v[i] << nl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Construct from components
|
||||||
|
template<class Type>
|
||||||
|
Foam::ensightSurfaceWriter<Type>::ensightSurfaceWriter()
|
||||||
|
:
|
||||||
|
surfaceWriter<Type>()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::ensightSurfaceWriter<Type>::~ensightSurfaceWriter()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::ensightSurfaceWriter<Type>::write
|
||||||
|
(
|
||||||
|
const fileName& outputDir,
|
||||||
|
const fileName& surfaceName,
|
||||||
|
const pointField& points,
|
||||||
|
const faceList& faces,
|
||||||
|
const bool verbose
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (!isDir(outputDir))
|
||||||
|
{
|
||||||
|
mkDir(outputDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
//const scalar timeValue = Foam::name(this->mesh().time().timeValue());
|
||||||
|
const scalar timeValue = 0.0;
|
||||||
|
|
||||||
|
|
||||||
|
OFstream caseStr(outputDir/surfaceName + ".case");
|
||||||
|
OFstream geomStr(outputDir/surfaceName + ".***.mesh");
|
||||||
|
|
||||||
|
if (verbose)
|
||||||
|
{
|
||||||
|
Info<< "Writing case file to " << caseStr.name() << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
caseStr
|
||||||
|
<< "FORMAT" << nl
|
||||||
|
<< "type: ensight gold" << nl
|
||||||
|
<< nl
|
||||||
|
<< "GEOMETRY" << nl
|
||||||
|
<< "model: 1 " << geomStr.name().name() << nl
|
||||||
|
<< nl
|
||||||
|
<< "TIME" << nl
|
||||||
|
<< "time set: 1" << nl
|
||||||
|
<< "number of steps: 1" << nl
|
||||||
|
<< "filename start number: 0" << nl
|
||||||
|
<< "filename increment: 1" << nl
|
||||||
|
<< "time values:" << nl
|
||||||
|
<< timeValue << nl
|
||||||
|
<< nl;
|
||||||
|
|
||||||
|
DynamicList<label> tris;
|
||||||
|
DynamicList<label> quads;
|
||||||
|
DynamicList<label> polys;
|
||||||
|
binShapes(points, faces, tris, quads, polys);
|
||||||
|
|
||||||
|
writeGeometry(surfaceName, geomStr, points, faces, tris, quads, polys);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::ensightSurfaceWriter<Type>::write
|
||||||
|
(
|
||||||
|
const fileName& outputDir,
|
||||||
|
const fileName& surfaceName,
|
||||||
|
const pointField& points,
|
||||||
|
const faceList& faces,
|
||||||
|
const word& fieldName,
|
||||||
|
const Field<Type>& values,
|
||||||
|
const bool isNodeValues,
|
||||||
|
const bool verbose
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (!isDir(outputDir/fieldName))
|
||||||
|
{
|
||||||
|
mkDir(outputDir/fieldName);
|
||||||
|
}
|
||||||
|
|
||||||
|
//const scalar timeValue = Foam::name(this->mesh().time().timeValue());
|
||||||
|
const scalar timeValue = 0.0;
|
||||||
|
|
||||||
|
|
||||||
|
OFstream caseStr(outputDir/fieldName/surfaceName + ".case");
|
||||||
|
OFstream geomStr(outputDir/fieldName/surfaceName + ".000.mesh");
|
||||||
|
OFstream fieldStr(outputDir/fieldName/surfaceName + ".000." + fieldName);
|
||||||
|
|
||||||
|
if (verbose)
|
||||||
|
{
|
||||||
|
Info<< "Writing case file to " << caseStr.name() << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
caseStr
|
||||||
|
<< "FORMAT" << nl
|
||||||
|
<< "type: ensight gold" << nl
|
||||||
|
<< nl
|
||||||
|
<< "GEOMETRY" << nl
|
||||||
|
<< "model: 1 " << geomStr.name().name() << nl
|
||||||
|
<< nl
|
||||||
|
<< "VARIABLE" << nl;
|
||||||
|
if (isNodeValues)
|
||||||
|
{
|
||||||
|
caseStr
|
||||||
|
<< pTraits<Type>::typeName << " per node:" << setw(10) << 1
|
||||||
|
<< " " << fieldName
|
||||||
|
<< " " << surfaceName.c_str() << ".***." << fieldName << nl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
caseStr
|
||||||
|
<< pTraits<Type>::typeName << " per element:" << setw(10) << 1
|
||||||
|
<< " " << fieldName
|
||||||
|
<< " " << surfaceName.c_str() << ".***." << fieldName << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
caseStr
|
||||||
|
<< nl
|
||||||
|
<< "TIME" << nl
|
||||||
|
<< "time set: 1" << nl
|
||||||
|
<< "number of steps: 1" << nl
|
||||||
|
<< "filename start number: 0" << nl
|
||||||
|
<< "filename increment: 1" << nl
|
||||||
|
<< "time values:" << nl
|
||||||
|
<< timeValue << nl
|
||||||
|
<< nl;
|
||||||
|
|
||||||
|
DynamicList<label> tris;
|
||||||
|
DynamicList<label> quads;
|
||||||
|
DynamicList<label> polys;
|
||||||
|
binShapes(points, faces, tris, quads, polys);
|
||||||
|
|
||||||
|
writeGeometry(surfaceName, geomStr, points, faces, tris, quads, polys);
|
||||||
|
|
||||||
|
// Write field
|
||||||
|
fieldStr
|
||||||
|
<< pTraits<Type>::typeName << nl
|
||||||
|
<< "part" << nl
|
||||||
|
<< setw(10) << 1 << nl;
|
||||||
|
|
||||||
|
if (isNodeValues)
|
||||||
|
{
|
||||||
|
fieldStr << "coordinates" << nl;
|
||||||
|
writeData(fieldStr, values);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (tris.size())
|
||||||
|
{
|
||||||
|
fieldStr << "tria3" << nl;
|
||||||
|
writeData(fieldStr, Field<Type>(values, tris));
|
||||||
|
}
|
||||||
|
if (quads.size())
|
||||||
|
{
|
||||||
|
fieldStr << "quad4" << nl;
|
||||||
|
writeData(fieldStr, Field<Type>(values, quads));
|
||||||
|
}
|
||||||
|
if (polys.size())
|
||||||
|
{
|
||||||
|
fieldStr << "nsided" << nl;
|
||||||
|
writeData(fieldStr, Field<Type>(values, polys));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,138 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::ensightSurfaceWriter
|
||||||
|
|
||||||
|
Description
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
ensightSurfaceWriter.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef ensightSurfaceWriter_H
|
||||||
|
#define ensightSurfaceWriter_H
|
||||||
|
|
||||||
|
#include "surfaceWriter.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class ensightSurfaceWriter Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
class ensightSurfaceWriter
|
||||||
|
:
|
||||||
|
public surfaceWriter<Type>
|
||||||
|
{
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
static void binShapes
|
||||||
|
(
|
||||||
|
const pointField& points,
|
||||||
|
const faceList& faces,
|
||||||
|
DynamicList<label>& tris,
|
||||||
|
DynamicList<label>& quads,
|
||||||
|
DynamicList<label>& polys
|
||||||
|
);
|
||||||
|
|
||||||
|
static void writeGeometry
|
||||||
|
(
|
||||||
|
const fileName&,
|
||||||
|
Ostream&,
|
||||||
|
const pointField&,
|
||||||
|
const faceList&,
|
||||||
|
const DynamicList<label>&,
|
||||||
|
const DynamicList<label>&,
|
||||||
|
const DynamicList<label>&
|
||||||
|
);
|
||||||
|
|
||||||
|
static void writeData(Ostream&, const Field<Type>& values);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("ensight");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct null
|
||||||
|
ensightSurfaceWriter();
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~ensightSurfaceWriter();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
// Write
|
||||||
|
|
||||||
|
//- Write geometry to file.
|
||||||
|
virtual void write
|
||||||
|
(
|
||||||
|
const fileName& outputDir,
|
||||||
|
const fileName& surfaceName,
|
||||||
|
const pointField& points,
|
||||||
|
const faceList& faces,
|
||||||
|
const bool verbose = false
|
||||||
|
) const;
|
||||||
|
|
||||||
|
|
||||||
|
//- Writes single surface to file.
|
||||||
|
virtual void write
|
||||||
|
(
|
||||||
|
const fileName& outputDir,
|
||||||
|
const fileName& surfaceName,
|
||||||
|
const pointField& points,
|
||||||
|
const faceList& faces,
|
||||||
|
const word& fieldName,
|
||||||
|
const Field<Type>& values,
|
||||||
|
const bool isNodeValues,
|
||||||
|
const bool verbose = false
|
||||||
|
) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "ensightSurfaceWriter.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,44 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "ensightSurfaceWriter.H"
|
||||||
|
#include "surfaceWriters.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makeSurfaceWriterType(ensightSurfaceWriter, bool);
|
||||||
|
makeSurfaceWriters(ensightSurfaceWriter);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -96,6 +96,7 @@ void Foam::foamFileSurfaceWriter<Type>::write
|
|||||||
const faceList& faces,
|
const faceList& faces,
|
||||||
const word& fieldName,
|
const word& fieldName,
|
||||||
const Field<Type>& values,
|
const Field<Type>& values,
|
||||||
|
const bool isNodeValues,
|
||||||
const bool verbose
|
const bool verbose
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
|||||||
@ -95,6 +95,7 @@ public:
|
|||||||
const faceList& faces,
|
const faceList& faces,
|
||||||
const word& fieldName,
|
const word& fieldName,
|
||||||
const Field<Type>& values,
|
const Field<Type>& values,
|
||||||
|
const bool isNodeValues,
|
||||||
const bool verbose = false
|
const bool verbose = false
|
||||||
) const;
|
) const;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -54,6 +54,7 @@ void Foam::nullSurfaceWriter<Type>::write
|
|||||||
const faceList& faces,
|
const faceList& faces,
|
||||||
const word& fieldName,
|
const word& fieldName,
|
||||||
const Field<Type>& values,
|
const Field<Type>& values,
|
||||||
|
const bool isNodeValues,
|
||||||
const bool verbose
|
const bool verbose
|
||||||
) const
|
) const
|
||||||
{}
|
{}
|
||||||
|
|||||||
@ -80,6 +80,7 @@ public:
|
|||||||
const faceList& faces,
|
const faceList& faces,
|
||||||
const word& fieldName,
|
const word& fieldName,
|
||||||
const Field<Type>& values,
|
const Field<Type>& values,
|
||||||
|
const bool isNodeValues,
|
||||||
const bool verbose = false
|
const bool verbose = false
|
||||||
) const;
|
) const;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -102,6 +102,7 @@ public:
|
|||||||
const faceList& faces,
|
const faceList& faces,
|
||||||
const word& fieldName,
|
const word& fieldName,
|
||||||
const Field<Type>& values,
|
const Field<Type>& values,
|
||||||
|
const bool isNodeValues,
|
||||||
const bool verbose = false
|
const bool verbose = false
|
||||||
) const
|
) const
|
||||||
{}
|
{}
|
||||||
|
|||||||
@ -68,6 +68,7 @@ void Foam::rawSurfaceWriter<Type>::writeData
|
|||||||
const pointField& points,
|
const pointField& points,
|
||||||
const faceList& faces,
|
const faceList& faces,
|
||||||
const scalarField& values,
|
const scalarField& values,
|
||||||
|
const bool isNodeValues,
|
||||||
Ostream& os
|
Ostream& os
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -75,7 +76,7 @@ void Foam::rawSurfaceWriter<Type>::writeData
|
|||||||
os << "# x y z " << fieldName << endl;
|
os << "# x y z " << fieldName << endl;
|
||||||
|
|
||||||
// Write data
|
// Write data
|
||||||
if (values.size() == points.size())
|
if (isNodeValues)
|
||||||
{
|
{
|
||||||
forAll(values, elemI)
|
forAll(values, elemI)
|
||||||
{
|
{
|
||||||
@ -104,6 +105,7 @@ void Foam::rawSurfaceWriter<Type>::writeData
|
|||||||
const pointField& points,
|
const pointField& points,
|
||||||
const faceList& faces,
|
const faceList& faces,
|
||||||
const vectorField& values,
|
const vectorField& values,
|
||||||
|
const bool isNodeValues,
|
||||||
Ostream& os
|
Ostream& os
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -115,7 +117,7 @@ void Foam::rawSurfaceWriter<Type>::writeData
|
|||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
// Write data
|
// Write data
|
||||||
if (values.size() == points.size())
|
if (isNodeValues)
|
||||||
{
|
{
|
||||||
forAll(values, elemI)
|
forAll(values, elemI)
|
||||||
{
|
{
|
||||||
@ -147,6 +149,7 @@ void Foam::rawSurfaceWriter<Type>::writeData
|
|||||||
const pointField& points,
|
const pointField& points,
|
||||||
const faceList& faces,
|
const faceList& faces,
|
||||||
const sphericalTensorField& values,
|
const sphericalTensorField& values,
|
||||||
|
const bool isNodeValues,
|
||||||
Ostream& os
|
Ostream& os
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -155,7 +158,7 @@ void Foam::rawSurfaceWriter<Type>::writeData
|
|||||||
os << fieldName << "_ii" << endl;
|
os << fieldName << "_ii" << endl;
|
||||||
|
|
||||||
// Write data
|
// Write data
|
||||||
if (values.size() == points.size())
|
if (isNodeValues)
|
||||||
{
|
{
|
||||||
forAll(values, elemI)
|
forAll(values, elemI)
|
||||||
{
|
{
|
||||||
@ -186,6 +189,7 @@ void Foam::rawSurfaceWriter<Type>::writeData
|
|||||||
const pointField& points,
|
const pointField& points,
|
||||||
const faceList& faces,
|
const faceList& faces,
|
||||||
const symmTensorField& values,
|
const symmTensorField& values,
|
||||||
|
const bool isNodeValues,
|
||||||
Ostream& os
|
Ostream& os
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -198,7 +202,7 @@ void Foam::rawSurfaceWriter<Type>::writeData
|
|||||||
os << endl;
|
os << endl;
|
||||||
|
|
||||||
// Write data
|
// Write data
|
||||||
if (values.size() == points.size())
|
if (isNodeValues)
|
||||||
{
|
{
|
||||||
forAll(values, elemI)
|
forAll(values, elemI)
|
||||||
{
|
{
|
||||||
@ -233,6 +237,7 @@ void Foam::rawSurfaceWriter<Type>::writeData
|
|||||||
const pointField& points,
|
const pointField& points,
|
||||||
const faceList& faces,
|
const faceList& faces,
|
||||||
const tensorField& values,
|
const tensorField& values,
|
||||||
|
const bool isNodeValues,
|
||||||
Ostream& os
|
Ostream& os
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -245,7 +250,7 @@ void Foam::rawSurfaceWriter<Type>::writeData
|
|||||||
os << endl;
|
os << endl;
|
||||||
|
|
||||||
// Write data
|
// Write data
|
||||||
if (values.size() == points.size())
|
if (isNodeValues)
|
||||||
{
|
{
|
||||||
forAll(values, elemI)
|
forAll(values, elemI)
|
||||||
{
|
{
|
||||||
@ -343,6 +348,7 @@ namespace Foam
|
|||||||
const faceList& faces,
|
const faceList& faces,
|
||||||
const word& fieldName,
|
const word& fieldName,
|
||||||
const Field<bool>& values,
|
const Field<bool>& values,
|
||||||
|
const bool isNodeValues,
|
||||||
const bool verbose
|
const bool verbose
|
||||||
) const
|
) const
|
||||||
{}
|
{}
|
||||||
@ -358,6 +364,7 @@ void Foam::rawSurfaceWriter<Type>::write
|
|||||||
const faceList& faces,
|
const faceList& faces,
|
||||||
const word& fieldName,
|
const word& fieldName,
|
||||||
const Field<Type>& values,
|
const Field<Type>& values,
|
||||||
|
const bool isNodeValues,
|
||||||
const bool verbose
|
const bool verbose
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
@ -379,7 +386,7 @@ void Foam::rawSurfaceWriter<Type>::write
|
|||||||
|
|
||||||
// header
|
// header
|
||||||
os << "# " << fieldName;
|
os << "# " << fieldName;
|
||||||
if (values.size() == points.size())
|
if (isNodeValues)
|
||||||
{
|
{
|
||||||
os << " POINT_DATA ";
|
os << " POINT_DATA ";
|
||||||
}
|
}
|
||||||
@ -390,7 +397,7 @@ void Foam::rawSurfaceWriter<Type>::write
|
|||||||
|
|
||||||
os << values.size() << nl;
|
os << values.size() << nl;
|
||||||
|
|
||||||
writeData(fieldName, points, faces, values, os);
|
writeData(fieldName, points, faces, values, isNodeValues, os);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -73,6 +73,7 @@ class rawSurfaceWriter
|
|||||||
const pointField& points,
|
const pointField& points,
|
||||||
const faceList& faces,
|
const faceList& faces,
|
||||||
const scalarField& values,
|
const scalarField& values,
|
||||||
|
const bool isNodeValues,
|
||||||
Ostream& os
|
Ostream& os
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -82,6 +83,7 @@ class rawSurfaceWriter
|
|||||||
const pointField& points,
|
const pointField& points,
|
||||||
const faceList& faces,
|
const faceList& faces,
|
||||||
const vectorField& values,
|
const vectorField& values,
|
||||||
|
const bool isNodeValues,
|
||||||
Ostream& os
|
Ostream& os
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -91,6 +93,7 @@ class rawSurfaceWriter
|
|||||||
const pointField& points,
|
const pointField& points,
|
||||||
const faceList& faces,
|
const faceList& faces,
|
||||||
const sphericalTensorField& values,
|
const sphericalTensorField& values,
|
||||||
|
const bool isNodeValues,
|
||||||
Ostream& os
|
Ostream& os
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -100,6 +103,7 @@ class rawSurfaceWriter
|
|||||||
const pointField& points,
|
const pointField& points,
|
||||||
const faceList& faces,
|
const faceList& faces,
|
||||||
const symmTensorField& values,
|
const symmTensorField& values,
|
||||||
|
const bool isNodeValues,
|
||||||
Ostream& os
|
Ostream& os
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -109,6 +113,7 @@ class rawSurfaceWriter
|
|||||||
const pointField& points,
|
const pointField& points,
|
||||||
const faceList& faces,
|
const faceList& faces,
|
||||||
const tensorField& values,
|
const tensorField& values,
|
||||||
|
const bool isNodeValues,
|
||||||
Ostream& os
|
Ostream& os
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -152,6 +157,7 @@ public:
|
|||||||
const faceList& faces,
|
const faceList& faces,
|
||||||
const word& fieldName,
|
const word& fieldName,
|
||||||
const Field<Type>& values,
|
const Field<Type>& values,
|
||||||
|
const bool isNodeValues,
|
||||||
const bool verbose = false
|
const bool verbose = false
|
||||||
) const;
|
) const;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -119,7 +119,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
//- Writes single surface to file. Either one value per vertex or
|
//- Writes single surface to file. Either one value per vertex or
|
||||||
// one value per face (detected by values.size()==faces.size())
|
// one value per face (isNodeValues = false)
|
||||||
virtual void write
|
virtual void write
|
||||||
(
|
(
|
||||||
const fileName& outputDir, // <root>/<case>/surface/TIME
|
const fileName& outputDir, // <root>/<case>/surface/TIME
|
||||||
@ -128,6 +128,7 @@ public:
|
|||||||
const faceList& faces,
|
const faceList& faces,
|
||||||
const word& fieldName, // name of field
|
const word& fieldName, // name of field
|
||||||
const Field<Type>& values,
|
const Field<Type>& values,
|
||||||
|
const bool isNodeValues,
|
||||||
const bool verbose = false
|
const bool verbose = false
|
||||||
) const = 0;
|
) const = 0;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -267,6 +267,7 @@ void Foam::vtkSurfaceWriter<Type>::write
|
|||||||
const faceList& faces,
|
const faceList& faces,
|
||||||
const word& fieldName,
|
const word& fieldName,
|
||||||
const Field<Type>& values,
|
const Field<Type>& values,
|
||||||
|
const bool isNodeValues,
|
||||||
const bool verbose
|
const bool verbose
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
@ -288,7 +289,7 @@ void Foam::vtkSurfaceWriter<Type>::write
|
|||||||
writeGeometry(os, points, faces);
|
writeGeometry(os, points, faces);
|
||||||
|
|
||||||
// start writing data
|
// start writing data
|
||||||
if (values.size() == points.size())
|
if (isNodeValues)
|
||||||
{
|
{
|
||||||
os << "POINT_DATA ";
|
os << "POINT_DATA ";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -97,6 +97,7 @@ public:
|
|||||||
const faceList& faces,
|
const faceList& faces,
|
||||||
const word& fieldName,
|
const word& fieldName,
|
||||||
const Field<Type>& values,
|
const Field<Type>& values,
|
||||||
|
const bool isNodeValues,
|
||||||
const bool verbose = false
|
const bool verbose = false
|
||||||
) const;
|
) const;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user