mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: rework surface writers as non-templated classes
- easier (more logical) when adding a new writer ENH: add surface field writer for 'starcd' format - creates *.usr files, which can be read in proSTAR with the 'getuser' command, but which can also be parsed directly since the format is extremely primitive
This commit is contained in:
@ -46,14 +46,14 @@ sampledSurface/thresholdCellFaces/sampledThresholdCellFaces.C
|
|||||||
|
|
||||||
surfWriters = sampledSurface/writers
|
surfWriters = sampledSurface/writers
|
||||||
|
|
||||||
$(surfWriters)/surfaceWriters.C
|
$(surfWriters)/surfaceWriter.C
|
||||||
$(surfWriters)/dx/dxSurfaceWriterRunTime.C
|
$(surfWriters)/dx/dxSurfaceWriter.C
|
||||||
$(surfWriters)/ensight/ensightSurfaceWriterRunTime.C
|
$(surfWriters)/ensight/ensightSurfaceWriter.C
|
||||||
$(surfWriters)/foamFile/foamFileSurfaceWriterRunTime.C
|
$(surfWriters)/foamFile/foamFileSurfaceWriter.C
|
||||||
$(surfWriters)/null/nullSurfaceWriterRunTime.C
|
$(surfWriters)/proxy/proxySurfaceWriter.C
|
||||||
$(surfWriters)/proxy/proxySurfaceWriterRunTime.C
|
$(surfWriters)/raw/rawSurfaceWriter.C
|
||||||
$(surfWriters)/raw/rawSurfaceWriterRunTime.C
|
$(surfWriters)/starcd/starcdSurfaceWriter.C
|
||||||
$(surfWriters)/vtk/vtkSurfaceWriterRunTime.C
|
$(surfWriters)/vtk/vtkSurfaceWriter.C
|
||||||
|
|
||||||
graphField/writePatchGraph.C
|
graphField/writePatchGraph.C
|
||||||
graphField/writeCellGraph.C
|
graphField/writeCellGraph.C
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -83,7 +83,7 @@ void Foam::sampledSurfaces::writeGeometry() const
|
|||||||
{
|
{
|
||||||
if (Pstream::master() && mergeList_[surfI].faces.size())
|
if (Pstream::master() && mergeList_[surfI].faces.size())
|
||||||
{
|
{
|
||||||
genericFormatter_->write
|
formatter_->write
|
||||||
(
|
(
|
||||||
outputDir,
|
outputDir,
|
||||||
s.name(),
|
s.name(),
|
||||||
@ -94,7 +94,7 @@ void Foam::sampledSurfaces::writeGeometry() const
|
|||||||
}
|
}
|
||||||
else if (s.faces().size())
|
else if (s.faces().size())
|
||||||
{
|
{
|
||||||
genericFormatter_->write
|
formatter_->write
|
||||||
(
|
(
|
||||||
outputDir,
|
outputDir,
|
||||||
s.name(),
|
s.name(),
|
||||||
@ -123,9 +123,8 @@ Foam::sampledSurfaces::sampledSurfaces
|
|||||||
outputPath_(fileName::null),
|
outputPath_(fileName::null),
|
||||||
fieldSelection_(),
|
fieldSelection_(),
|
||||||
interpolationScheme_(word::null),
|
interpolationScheme_(word::null),
|
||||||
writeFormat_(word::null),
|
|
||||||
mergeList_(),
|
mergeList_(),
|
||||||
genericFormatter_(NULL),
|
formatter_(NULL),
|
||||||
scalarFields_(),
|
scalarFields_(),
|
||||||
vectorFields_(),
|
vectorFields_(),
|
||||||
sphericalTensorFields_(),
|
sphericalTensorFields_(),
|
||||||
@ -201,7 +200,7 @@ void Foam::sampledSurfaces::write()
|
|||||||
|
|
||||||
// write geometry first if required,
|
// write geometry first if required,
|
||||||
// or when no fields would otherwise be written
|
// or when no fields would otherwise be written
|
||||||
if (nFields == 0 || genericFormatter_->separateFiles())
|
if (nFields == 0 || formatter_->separateGeometry())
|
||||||
{
|
{
|
||||||
writeGeometry();
|
writeGeometry();
|
||||||
}
|
}
|
||||||
@ -221,11 +220,11 @@ void Foam::sampledSurfaces::read(const dictionary& dict)
|
|||||||
clearFieldGroups();
|
clearFieldGroups();
|
||||||
|
|
||||||
dict.lookup("interpolationScheme") >> interpolationScheme_;
|
dict.lookup("interpolationScheme") >> interpolationScheme_;
|
||||||
dict.lookup("surfaceFormat") >> writeFormat_;
|
|
||||||
|
|
||||||
// define the generic (geometry) writer
|
word writeFormat(dict.lookup("surfaceFormat"));
|
||||||
genericFormatter_ = surfaceWriter<bool>::New(writeFormat_);
|
|
||||||
|
|
||||||
|
// define the surface formatter
|
||||||
|
formatter_ = surfaceWriter::New(writeFormat);
|
||||||
|
|
||||||
PtrList<sampledSurface> newList
|
PtrList<sampledSurface> newList
|
||||||
(
|
(
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -68,36 +68,11 @@ class sampledSurfaces
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- The surface formatter
|
|
||||||
autoPtr< surfaceWriter<Type> > formatter;
|
|
||||||
|
|
||||||
//- Construct null
|
//- Construct null
|
||||||
fieldGroup()
|
fieldGroup()
|
||||||
:
|
:
|
||||||
DynamicList<word>(0),
|
DynamicList<word>(0)
|
||||||
formatter(NULL)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//- Construct for a particular surface format
|
|
||||||
fieldGroup(const word& writeFormat)
|
|
||||||
:
|
|
||||||
DynamicList<word>(0),
|
|
||||||
formatter(surfaceWriter<Type>::New(writeFormat))
|
|
||||||
{}
|
|
||||||
|
|
||||||
//- Reset format and field list
|
|
||||||
void clear()
|
|
||||||
{
|
|
||||||
DynamicList<word>::clear();
|
|
||||||
formatter.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Assign a new formatter
|
|
||||||
void operator=(const word& writeFormat)
|
|
||||||
{
|
|
||||||
formatter = surfaceWriter<Type>::New(writeFormat);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -151,10 +126,6 @@ class sampledSurfaces
|
|||||||
//- Interpolation scheme to use
|
//- Interpolation scheme to use
|
||||||
word interpolationScheme_;
|
word interpolationScheme_;
|
||||||
|
|
||||||
//- Output format to use
|
|
||||||
word writeFormat_;
|
|
||||||
|
|
||||||
|
|
||||||
// surfaces
|
// surfaces
|
||||||
|
|
||||||
//- Information for merging surfaces
|
//- Information for merging surfaces
|
||||||
@ -163,8 +134,8 @@ class sampledSurfaces
|
|||||||
|
|
||||||
// Calculated
|
// Calculated
|
||||||
|
|
||||||
//- Generic surface formatter
|
//- Surface formatter
|
||||||
autoPtr< surfaceWriter<bool> > genericFormatter_;
|
autoPtr<surfaceWriter> formatter_;
|
||||||
|
|
||||||
//- Categorized scalar/vector/tensor fields
|
//- Categorized scalar/vector/tensor fields
|
||||||
fieldGroup<scalar> scalarFields_;
|
fieldGroup<scalar> scalarFields_;
|
||||||
@ -190,14 +161,10 @@ class sampledSurfaces
|
|||||||
|
|
||||||
//- Sample and write a particular volume field
|
//- Sample and write a particular volume field
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void sampleAndWrite
|
void sampleAndWrite(const GeometricField<Type, fvPatchField, volMesh>&);
|
||||||
(
|
|
||||||
const GeometricField<Type, fvPatchField, volMesh>&,
|
|
||||||
const surfaceWriter<Type>& formatter
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Sample and write all the fields of the given type
|
//- Sample and write all the fields of the given type
|
||||||
template <class Type>
|
template<class Type>
|
||||||
void sampleAndWrite(fieldGroup<Type>&);
|
void sampleAndWrite(fieldGroup<Type>&);
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct and assignment
|
//- Disallow default bitwise copy construct and assignment
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -32,8 +32,7 @@ License
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::sampledSurfaces::sampleAndWrite
|
void Foam::sampledSurfaces::sampleAndWrite
|
||||||
(
|
(
|
||||||
const GeometricField<Type, fvPatchField, volMesh>& vField,
|
const GeometricField<Type, fvPatchField, volMesh>& vField
|
||||||
const surfaceWriter<Type>& formatter
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// interpolator for this field
|
// interpolator for this field
|
||||||
@ -96,7 +95,7 @@ void Foam::sampledSurfaces::sampleAndWrite
|
|||||||
// skip surface without faces (eg, a failed cut-plane)
|
// skip surface without faces (eg, a failed cut-plane)
|
||||||
if (mergeList_[surfI].faces.size())
|
if (mergeList_[surfI].faces.size())
|
||||||
{
|
{
|
||||||
formatter.write
|
formatter_->write
|
||||||
(
|
(
|
||||||
outputDir,
|
outputDir,
|
||||||
s.name(),
|
s.name(),
|
||||||
@ -115,7 +114,7 @@ void Foam::sampledSurfaces::sampleAndWrite
|
|||||||
// skip surface without faces (eg, a failed cut-plane)
|
// skip surface without faces (eg, a failed cut-plane)
|
||||||
if (s.faces().size())
|
if (s.faces().size())
|
||||||
{
|
{
|
||||||
formatter.write
|
formatter_->write
|
||||||
(
|
(
|
||||||
outputDir,
|
outputDir,
|
||||||
s.name(),
|
s.name(),
|
||||||
@ -139,12 +138,6 @@ void Foam::sampledSurfaces::sampleAndWrite
|
|||||||
{
|
{
|
||||||
if (fields.size())
|
if (fields.size())
|
||||||
{
|
{
|
||||||
// create or use existing surfaceWriter
|
|
||||||
if (fields.formatter.empty())
|
|
||||||
{
|
|
||||||
fields.formatter = surfaceWriter<Type>::New(writeFormat_);
|
|
||||||
}
|
|
||||||
|
|
||||||
forAll(fields, fieldI)
|
forAll(fields, fieldI)
|
||||||
{
|
{
|
||||||
if (Pstream::master() && verbose_)
|
if (Pstream::master() && verbose_)
|
||||||
@ -168,8 +161,7 @@ void Foam::sampledSurfaces::sampleAndWrite
|
|||||||
false
|
false
|
||||||
),
|
),
|
||||||
mesh_
|
mesh_
|
||||||
),
|
)
|
||||||
fields.formatter()
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -190,8 +182,7 @@ void Foam::sampledSurfaces::sampleAndWrite
|
|||||||
<GeometricField<Type, fvPatchField, volMesh> >
|
<GeometricField<Type, fvPatchField, volMesh> >
|
||||||
(
|
(
|
||||||
fields[fieldI]
|
fields[fieldI]
|
||||||
),
|
)
|
||||||
fields.formatter()
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -28,10 +28,19 @@ License
|
|||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
#include "OSspecific.H"
|
#include "OSspecific.H"
|
||||||
|
|
||||||
|
#include "makeSurfaceWriterMethods.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
makeSurfaceWriterType(dxSurfaceWriter);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
void Foam::dxSurfaceWriter::writeGeometry
|
||||||
void Foam::dxSurfaceWriter<Type>::writeGeometry
|
|
||||||
(
|
(
|
||||||
Ostream& os,
|
Ostream& os,
|
||||||
const pointField& points,
|
const pointField& points,
|
||||||
@ -54,7 +63,6 @@ void Foam::dxSurfaceWriter<Type>::writeGeometry
|
|||||||
os << nl;
|
os << nl;
|
||||||
|
|
||||||
// Write triangles
|
// Write triangles
|
||||||
|
|
||||||
os << "# The irregular connections (triangles)" << nl
|
os << "# The irregular connections (triangles)" << nl
|
||||||
<< "object 2 class array type int rank 1 shape 3 items "
|
<< "object 2 class array type int rank 1 shape 3 items "
|
||||||
<< faces.size() << " data follows" << nl;
|
<< faces.size() << " data follows" << nl;
|
||||||
@ -80,17 +88,41 @@ void Foam::dxSurfaceWriter<Type>::writeGeometry
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::dxSurfaceWriter::writeTrailer(Ostream& os, const bool isNodeValues)
|
||||||
|
{
|
||||||
|
if (isNodeValues)
|
||||||
|
{
|
||||||
|
os << nl << "attribute \"dep\" string \"positions\""
|
||||||
|
<< nl << nl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
os << nl << "attribute \"dep\" string \"connections\""
|
||||||
|
<< nl << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
os << "# the field, with three components: \"positions\","
|
||||||
|
<< " \"connections\", and \"data\"" << nl
|
||||||
|
<< "object \"irregular positions irregular "
|
||||||
|
<< "connections\" class field"
|
||||||
|
<< nl
|
||||||
|
<< "component \"positions\" value 1" << nl
|
||||||
|
<< "component \"connections\" value 2" << nl
|
||||||
|
<< "component \"data\" value 3" << nl;
|
||||||
|
|
||||||
|
os << "end" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
// Write scalarField in DX format
|
|
||||||
template<>
|
template<>
|
||||||
void Foam::dxSurfaceWriter<Foam::scalar>::writeData
|
void Foam::dxSurfaceWriter::writeData
|
||||||
(
|
(
|
||||||
Ostream& os,
|
Ostream& os,
|
||||||
const Field<scalar>& values
|
const Field<scalar>& values
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Write data
|
|
||||||
os << "object 3 class array type float rank 0 items "
|
os << "object 3 class array type float rank 0 items "
|
||||||
<< values.size() << " data follows" << nl;
|
<< values.size() << " data follows" << nl;
|
||||||
|
|
||||||
@ -101,15 +133,13 @@ namespace Foam
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Write vectorField in DX format
|
|
||||||
template<>
|
template<>
|
||||||
void Foam::dxSurfaceWriter<Foam::vector>::writeData
|
void Foam::dxSurfaceWriter::writeData
|
||||||
(
|
(
|
||||||
Ostream& os,
|
Ostream& os,
|
||||||
const Field<vector>& values
|
const Field<vector>& values
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Write data
|
|
||||||
os << "object 3 class array type float rank 1 shape 3 items "
|
os << "object 3 class array type float rank 1 shape 3 items "
|
||||||
<< values.size() << " data follows" << nl;
|
<< values.size() << " data follows" << nl;
|
||||||
|
|
||||||
@ -122,15 +152,13 @@ namespace Foam
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Write sphericalTensorField in DX format
|
|
||||||
template<>
|
template<>
|
||||||
void Foam::dxSurfaceWriter<Foam::sphericalTensor>::writeData
|
void Foam::dxSurfaceWriter::writeData
|
||||||
(
|
(
|
||||||
Ostream& os,
|
Ostream& os,
|
||||||
const Field<sphericalTensor>& values
|
const Field<sphericalTensor>& values
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Write data
|
|
||||||
os << "object 3 class array type float rank 0 items "
|
os << "object 3 class array type float rank 0 items "
|
||||||
<< values.size() << " data follows" << nl;
|
<< values.size() << " data follows" << nl;
|
||||||
|
|
||||||
@ -141,15 +169,13 @@ namespace Foam
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Write symmTensorField in DX format
|
|
||||||
template<>
|
template<>
|
||||||
void Foam::dxSurfaceWriter<Foam::symmTensor>::writeData
|
void Foam::dxSurfaceWriter::writeData
|
||||||
(
|
(
|
||||||
Ostream& os,
|
Ostream& os,
|
||||||
const Field<symmTensor>& values
|
const Field<symmTensor>& values
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Write data
|
|
||||||
os << "object 3 class array type float rank 2 shape 3 items "
|
os << "object 3 class array type float rank 2 shape 3 items "
|
||||||
<< values.size() << " data follows" << nl;
|
<< values.size() << " data follows" << nl;
|
||||||
|
|
||||||
@ -165,15 +191,14 @@ namespace Foam
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Write tensorField in DX format
|
// Write Field<tensor> in DX format
|
||||||
template<>
|
template<>
|
||||||
void Foam::dxSurfaceWriter<Foam::tensor>::writeData
|
inline void Foam::dxSurfaceWriter::writeData
|
||||||
(
|
(
|
||||||
Ostream& os,
|
Ostream& os,
|
||||||
const Field<tensor>& values
|
const Field<tensor>& values
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Write data
|
|
||||||
os << "object 3 class array type float rank 2 shape 3 items "
|
os << "object 3 class array type float rank 2 shape 3 items "
|
||||||
<< values.size() << " data follows" << nl;
|
<< values.size() << " data follows" << nl;
|
||||||
|
|
||||||
@ -189,15 +214,15 @@ namespace Foam
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write tensorField in DX format
|
|
||||||
|
// arbitrary field
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::dxSurfaceWriter<Type>::writeData
|
inline void Foam::dxSurfaceWriter::writeData
|
||||||
(
|
(
|
||||||
Ostream& os,
|
Ostream& os,
|
||||||
const Field<Type>& values
|
const Field<Type>& values
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Write data
|
|
||||||
os << "object 3 class array type float rank 0 items "
|
os << "object 3 class array type float rank 0 items "
|
||||||
<< values.size() << " data follows" << nl;
|
<< values.size() << " data follows" << nl;
|
||||||
|
|
||||||
@ -208,41 +233,8 @@ void Foam::dxSurfaceWriter<Type>::writeData
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Write trailer in DX format
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::dxSurfaceWriter<Type>::writeTrailer(Ostream& os)
|
void Foam::dxSurfaceWriter::writeTemplate
|
||||||
{
|
|
||||||
os << "# the field, with three components: \"positions\","
|
|
||||||
<< " \"connections\", and \"data\"" << nl
|
|
||||||
<< "object \"irregular positions irregular "
|
|
||||||
<< "connections\" class field"
|
|
||||||
<< nl
|
|
||||||
<< "component \"positions\" value 1" << nl
|
|
||||||
<< "component \"connections\" value 2" << nl
|
|
||||||
<< "component \"data\" value 3" << nl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Foam::dxSurfaceWriter<Type>::dxSurfaceWriter()
|
|
||||||
:
|
|
||||||
surfaceWriter<Type>()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Foam::dxSurfaceWriter<Type>::~dxSurfaceWriter()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::dxSurfaceWriter<Type>::write
|
|
||||||
(
|
(
|
||||||
const fileName& outputDir,
|
const fileName& outputDir,
|
||||||
const fileName& surfaceName,
|
const fileName& surfaceName,
|
||||||
@ -270,24 +262,29 @@ void Foam::dxSurfaceWriter<Type>::write
|
|||||||
}
|
}
|
||||||
|
|
||||||
writeGeometry(os, points, faces);
|
writeGeometry(os, points, faces);
|
||||||
|
|
||||||
writeData(os, values);
|
writeData(os, values);
|
||||||
|
writeTrailer(os, isNodeValues);
|
||||||
if (isNodeValues)
|
|
||||||
{
|
|
||||||
os << nl << "attribute \"dep\" string \"positions\""
|
|
||||||
<< nl << nl;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
os << nl << "attribute \"dep\" string \"connections\""
|
|
||||||
<< nl << nl;
|
|
||||||
}
|
|
||||||
|
|
||||||
writeTrailer(os);
|
|
||||||
|
|
||||||
os << "end" << nl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::dxSurfaceWriter::dxSurfaceWriter()
|
||||||
|
:
|
||||||
|
surfaceWriter()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::dxSurfaceWriter::~dxSurfaceWriter()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// create write methods
|
||||||
|
defineSurfaceWriterWriteFields(Foam::dxSurfaceWriter);
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -25,6 +25,7 @@ Class
|
|||||||
Foam::dxSurfaceWriter
|
Foam::dxSurfaceWriter
|
||||||
|
|
||||||
Description
|
Description
|
||||||
|
A surfaceWriter for OpenDX format.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
dxSurfaceWriter.C
|
dxSurfaceWriter.C
|
||||||
@ -42,22 +43,36 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class dxSurfaceWriter Declaration
|
Class dxSurfaceWriter Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
class dxSurfaceWriter
|
class dxSurfaceWriter
|
||||||
:
|
:
|
||||||
public surfaceWriter<Type>
|
public surfaceWriter
|
||||||
{
|
{
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
static void writeGeometry(Ostream&, const pointField&, const faceList&);
|
static void writeGeometry(Ostream&, const pointField&, const faceList&);
|
||||||
|
static void writeTrailer(Ostream&, const bool isNodeValues);
|
||||||
|
|
||||||
static void writeData(Ostream&, const Field<Type>& values);
|
template<class Type>
|
||||||
|
static void writeData(Ostream&, const Field<Type>&);
|
||||||
|
|
||||||
|
//- Templated write operation
|
||||||
|
template<class Type>
|
||||||
|
void writeTemplate
|
||||||
|
(
|
||||||
|
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;
|
||||||
|
|
||||||
static void writeTrailer(Ostream&);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -77,20 +92,76 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
// Write
|
//- Write scalarField for a single surface to file.
|
||||||
|
// One value per face or vertex (isNodeValues = true)
|
||||||
//- Writes single surface to file.
|
|
||||||
virtual void write
|
virtual void write
|
||||||
(
|
(
|
||||||
const fileName& outputDir,
|
const fileName& outputDir, // <root>/<case>/surface/TIME
|
||||||
const fileName& surfaceName,
|
const fileName& surfaceName, // name of surface
|
||||||
const pointField& points,
|
const pointField& points,
|
||||||
const faceList& faces,
|
const faceList& faces,
|
||||||
const word& fieldName,
|
const word& fieldName, // name of field
|
||||||
const Field<Type>& values,
|
const Field<scalar>& values,
|
||||||
const bool isNodeValues,
|
const bool isNodeValues,
|
||||||
const bool verbose = false
|
const bool verbose = false
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
//- Write vectorField for a single surface to file.
|
||||||
|
// One value per face or vertex (isNodeValues = true)
|
||||||
|
virtual void write
|
||||||
|
(
|
||||||
|
const fileName& outputDir, // <root>/<case>/surface/TIME
|
||||||
|
const fileName& surfaceName, // name of surface
|
||||||
|
const pointField& points,
|
||||||
|
const faceList& faces,
|
||||||
|
const word& fieldName, // name of field
|
||||||
|
const Field<vector>& values,
|
||||||
|
const bool isNodeValues,
|
||||||
|
const bool verbose = false
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Write sphericalTensorField for a single surface to file.
|
||||||
|
// One value per face or vertex (isNodeValues = true)
|
||||||
|
virtual void write
|
||||||
|
(
|
||||||
|
const fileName& outputDir, // <root>/<case>/surface/TIME
|
||||||
|
const fileName& surfaceName, // name of surface
|
||||||
|
const pointField& points,
|
||||||
|
const faceList& faces,
|
||||||
|
const word& fieldName, // name of field
|
||||||
|
const Field<sphericalTensor>& values,
|
||||||
|
const bool isNodeValues,
|
||||||
|
const bool verbose = false
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Write symmTensorField for a single surface to file.
|
||||||
|
// One value per face or vertex (isNodeValues = true)
|
||||||
|
virtual void write
|
||||||
|
(
|
||||||
|
const fileName& outputDir, // <root>/<case>/surface/TIME
|
||||||
|
const fileName& surfaceName, // name of surface
|
||||||
|
const pointField& points,
|
||||||
|
const faceList& faces,
|
||||||
|
const word& fieldName, // name of field
|
||||||
|
const Field<symmTensor>& values,
|
||||||
|
const bool isNodeValues,
|
||||||
|
const bool verbose = false
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Write tensorField for a single surface to file.
|
||||||
|
// One value per face or vertex (isNodeValues = true)
|
||||||
|
virtual void write
|
||||||
|
(
|
||||||
|
const fileName& outputDir, // <root>/<case>/surface/TIME
|
||||||
|
const fileName& surfaceName, // name of surface
|
||||||
|
const pointField& points,
|
||||||
|
const faceList& faces,
|
||||||
|
const word& fieldName, // name of field
|
||||||
|
const Field<tensor>& values,
|
||||||
|
const bool isNodeValues,
|
||||||
|
const bool verbose = false
|
||||||
|
) const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -100,12 +171,6 @@ public:
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#ifdef NoRepository
|
|
||||||
# include "dxSurfaceWriter.C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -1,43 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2004-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 "dxSurfaceWriter.H"
|
|
||||||
#include "surfaceWriters.H"
|
|
||||||
#include "addToRunTimeSelectionTable.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
makeSurfaceWriters(dxSurfaceWriter);
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -31,6 +31,16 @@ License
|
|||||||
#include "ensightGeoFile.H"
|
#include "ensightGeoFile.H"
|
||||||
#include "ensightPartNonMeshFaces.H"
|
#include "ensightPartNonMeshFaces.H"
|
||||||
|
|
||||||
|
#include "makeSurfaceWriterMethods.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
makeSurfaceWriterType(ensightSurfaceWriter);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
@ -38,30 +48,15 @@ namespace Foam
|
|||||||
|
|
||||||
// Write scalarField in ensight format
|
// Write scalarField in ensight format
|
||||||
template<>
|
template<>
|
||||||
void Foam::ensightSurfaceWriter<Foam::scalar>::writeData
|
inline void Foam::ensightSurfaceWriter::writeData
|
||||||
(
|
(
|
||||||
Ostream& os,
|
Ostream& os,
|
||||||
const Field<Foam::scalar>& values
|
const Field<scalar>& values
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
forAll(values, i)
|
forAll(values, i)
|
||||||
{
|
{
|
||||||
os << values[i] << nl;
|
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -69,96 +64,25 @@ namespace Foam
|
|||||||
|
|
||||||
// Write generic field in ensight format
|
// Write generic field in ensight format
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::ensightSurfaceWriter<Type>::writeData
|
inline void Foam::ensightSurfaceWriter::writeData
|
||||||
(
|
(
|
||||||
Ostream& os,
|
Ostream& os,
|
||||||
const Field<Type>& values
|
const Field<Type>& values
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
for (direction cmpt = 0; cmpt < vector::nComponents; cmpt++)
|
for (direction cmpt = 0; cmpt < vector::nComponents; ++cmpt)
|
||||||
{
|
{
|
||||||
scalarField v(values.component(cmpt));
|
scalarField v(values.component(cmpt));
|
||||||
forAll(v, i)
|
forAll(v, i)
|
||||||
{
|
{
|
||||||
os << v[i] << nl;
|
os << v[i] << nl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
// Construct from components
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::ensightSurfaceWriter<Type>::ensightSurfaceWriter()
|
void Foam::ensightSurfaceWriter::writeTemplate
|
||||||
:
|
|
||||||
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");
|
|
||||||
ensightGeoFile geomStr
|
|
||||||
(
|
|
||||||
outputDir/surfaceName + ".000.mesh",
|
|
||||||
IOstream::ASCII
|
|
||||||
);
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
ensightPartNonMeshFaces faceWriter(0, geomStr.name().name(), faces, points);
|
|
||||||
faceWriter.writeGeometry(geomStr);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::ensightSurfaceWriter<Type>::write
|
|
||||||
(
|
(
|
||||||
const fileName& outputDir,
|
const fileName& outputDir,
|
||||||
const fileName& surfaceName,
|
const fileName& surfaceName,
|
||||||
@ -175,10 +99,9 @@ void Foam::ensightSurfaceWriter<Type>::write
|
|||||||
mkDir(outputDir/fieldName);
|
mkDir(outputDir/fieldName);
|
||||||
}
|
}
|
||||||
|
|
||||||
//const scalar timeValue = Foam::name(this->mesh().time().timeValue());
|
// const scalar timeValue = Foam::name(this->mesh().time().timeValue());
|
||||||
const scalar timeValue = 0.0;
|
const scalar timeValue = 0.0;
|
||||||
|
|
||||||
|
|
||||||
OFstream caseStr(outputDir/fieldName/surfaceName + ".case");
|
OFstream caseStr(outputDir/fieldName/surfaceName + ".case");
|
||||||
ensightGeoFile geomStr
|
ensightGeoFile geomStr
|
||||||
(
|
(
|
||||||
@ -230,8 +153,8 @@ void Foam::ensightSurfaceWriter<Type>::write
|
|||||||
<< timeValue << nl
|
<< timeValue << nl
|
||||||
<< nl;
|
<< nl;
|
||||||
|
|
||||||
ensightPartNonMeshFaces faceWriter(0, geomStr.name().name(), faces, points);
|
ensightPartNonMeshFaces ensPart(0, geomStr.name().name(), faces, points);
|
||||||
faceWriter.writeGeometry(geomStr);
|
geomStr << ensPart;
|
||||||
|
|
||||||
// Write field
|
// Write field
|
||||||
fieldStr
|
fieldStr
|
||||||
@ -246,19 +169,19 @@ void Foam::ensightSurfaceWriter<Type>::write
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//faceWriter.writeField(fieldStr, values);
|
// ensPart.writeField(fieldStr, values);
|
||||||
forAll(faceWriter.elementTypes(), elemI)
|
forAll(ensPart.elementTypes(), elemI)
|
||||||
{
|
{
|
||||||
if (faceWriter.elemLists()[elemI].size())
|
if (ensPart.elemLists()[elemI].size())
|
||||||
{
|
{
|
||||||
fieldStr.writeKeyword(faceWriter.elementTypes()[elemI]);
|
fieldStr.writeKeyword(ensPart.elementTypes()[elemI]);
|
||||||
writeData
|
writeData
|
||||||
(
|
(
|
||||||
fieldStr,
|
fieldStr,
|
||||||
Field<Type>
|
Field<Type>
|
||||||
(
|
(
|
||||||
values,
|
values,
|
||||||
faceWriter.elemLists()[elemI]
|
ensPart.elemLists()[elemI]
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -267,4 +190,75 @@ void Foam::ensightSurfaceWriter<Type>::write
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::ensightSurfaceWriter::ensightSurfaceWriter()
|
||||||
|
:
|
||||||
|
surfaceWriter()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::ensightSurfaceWriter::~ensightSurfaceWriter()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::ensightSurfaceWriter::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");
|
||||||
|
ensightGeoFile geomStr
|
||||||
|
(
|
||||||
|
outputDir/surfaceName + ".000.mesh",
|
||||||
|
IOstream::ASCII
|
||||||
|
);
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
ensightPartNonMeshFaces ensPart(0, geomStr.name().name(), faces, points);
|
||||||
|
geomStr << ensPart;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// create write methods
|
||||||
|
defineSurfaceWriterWriteFields(Foam::ensightSurfaceWriter);
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -25,6 +25,7 @@ Class
|
|||||||
Foam::ensightSurfaceWriter
|
Foam::ensightSurfaceWriter
|
||||||
|
|
||||||
Description
|
Description
|
||||||
|
A surfaceWriter for Ensight format.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
ensightSurfaceWriter.C
|
ensightSurfaceWriter.C
|
||||||
@ -41,29 +42,41 @@ SourceFiles
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
class ensightGeoFile;
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class ensightSurfaceWriter Declaration
|
Class ensightSurfaceWriter Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
class ensightSurfaceWriter
|
class ensightSurfaceWriter
|
||||||
:
|
:
|
||||||
public surfaceWriter<Type>
|
public surfaceWriter
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
fileName caseFileName_;
|
// fileName caseFileName_;
|
||||||
fileName surfaceName_;
|
// fileName surfaceName_;
|
||||||
fileName geomName_;
|
// fileName geomName_;
|
||||||
DynamicList<word> varNames_;
|
// DynamicList<word> varNames_;
|
||||||
DynamicList<fileName> varFileNames_;
|
// DynamicList<fileName> varFileNames_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
static void writeData(Ostream&, const Field<Type>& values);
|
template<class Type>
|
||||||
|
static inline void writeData(Ostream&, const Field<Type>&);
|
||||||
|
|
||||||
|
//- Templated write operation
|
||||||
|
template<class Type>
|
||||||
|
void writeTemplate
|
||||||
|
(
|
||||||
|
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;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -84,9 +97,15 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
// Write
|
//- True if the surface format supports geometry in a separate file.
|
||||||
|
// False if geometry and field must be in a single file
|
||||||
|
virtual bool separateGeometry()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
//- Write geometry to file.
|
|
||||||
|
//- Write single surface geometry to file.
|
||||||
virtual void write
|
virtual void write
|
||||||
(
|
(
|
||||||
const fileName& outputDir,
|
const fileName& outputDir,
|
||||||
@ -97,18 +116,76 @@ public:
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|
||||||
//- Writes single surface to file.
|
//- Write scalarField for a single surface to file.
|
||||||
|
// One value per face or vertex (isNodeValues = true)
|
||||||
virtual void write
|
virtual void write
|
||||||
(
|
(
|
||||||
const fileName& outputDir,
|
const fileName& outputDir, // <root>/<case>/surface/TIME
|
||||||
const fileName& surfaceName,
|
const fileName& surfaceName, // name of surface
|
||||||
const pointField& points,
|
const pointField& points,
|
||||||
const faceList& faces,
|
const faceList& faces,
|
||||||
const word& fieldName,
|
const word& fieldName, // name of field
|
||||||
const Field<Type>& values,
|
const Field<scalar>& values,
|
||||||
const bool isNodeValues,
|
const bool isNodeValues,
|
||||||
const bool verbose = false
|
const bool verbose = false
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
//- Write vectorField for a single surface to file.
|
||||||
|
// One value per face or vertex (isNodeValues = true)
|
||||||
|
virtual void write
|
||||||
|
(
|
||||||
|
const fileName& outputDir, // <root>/<case>/surface/TIME
|
||||||
|
const fileName& surfaceName, // name of surface
|
||||||
|
const pointField& points,
|
||||||
|
const faceList& faces,
|
||||||
|
const word& fieldName, // name of field
|
||||||
|
const Field<vector>& values,
|
||||||
|
const bool isNodeValues,
|
||||||
|
const bool verbose = false
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Write sphericalTensorField for a single surface to file.
|
||||||
|
// One value per face or vertex (isNodeValues = true)
|
||||||
|
virtual void write
|
||||||
|
(
|
||||||
|
const fileName& outputDir, // <root>/<case>/surface/TIME
|
||||||
|
const fileName& surfaceName, // name of surface
|
||||||
|
const pointField& points,
|
||||||
|
const faceList& faces,
|
||||||
|
const word& fieldName, // name of field
|
||||||
|
const Field<sphericalTensor>& values,
|
||||||
|
const bool isNodeValues,
|
||||||
|
const bool verbose = false
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Write symmTensorField for a single surface to file.
|
||||||
|
// One value per face or vertex (isNodeValues = true)
|
||||||
|
virtual void write
|
||||||
|
(
|
||||||
|
const fileName& outputDir, // <root>/<case>/surface/TIME
|
||||||
|
const fileName& surfaceName, // name of surface
|
||||||
|
const pointField& points,
|
||||||
|
const faceList& faces,
|
||||||
|
const word& fieldName, // name of field
|
||||||
|
const Field<symmTensor>& values,
|
||||||
|
const bool isNodeValues,
|
||||||
|
const bool verbose = false
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Write tensorField for a single surface to file.
|
||||||
|
// One value per face or vertex (isNodeValues = true)
|
||||||
|
virtual void write
|
||||||
|
(
|
||||||
|
const fileName& outputDir, // <root>/<case>/surface/TIME
|
||||||
|
const fileName& surfaceName, // name of surface
|
||||||
|
const pointField& points,
|
||||||
|
const faceList& faces,
|
||||||
|
const word& fieldName, // name of field
|
||||||
|
const Field<tensor>& values,
|
||||||
|
const bool isNodeValues,
|
||||||
|
const bool verbose = false
|
||||||
|
) const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -118,12 +195,6 @@ public:
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#ifdef NoRepository
|
|
||||||
# include "ensightSurfaceWriter.C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -1,44 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / 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
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -28,67 +28,20 @@ License
|
|||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
#include "OSspecific.H"
|
#include "OSspecific.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
#include "makeSurfaceWriterMethods.H"
|
||||||
|
|
||||||
template<class Type>
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
Foam::foamFileSurfaceWriter<Type>::foamFileSurfaceWriter()
|
|
||||||
:
|
|
||||||
surfaceWriter<Type>()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Foam::foamFileSurfaceWriter<Type>::~foamFileSurfaceWriter()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::foamFileSurfaceWriter<Type>::write
|
|
||||||
(
|
|
||||||
const fileName& outputDir,
|
|
||||||
const fileName& surfaceName,
|
|
||||||
const pointField& points,
|
|
||||||
const faceList& faces,
|
|
||||||
const bool verbose
|
|
||||||
) const
|
|
||||||
{
|
{
|
||||||
fileName surfaceDir(outputDir/surfaceName);
|
makeSurfaceWriterType(foamFileSurfaceWriter);
|
||||||
|
|
||||||
if (!isDir(surfaceDir))
|
|
||||||
{
|
|
||||||
mkDir(surfaceDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (verbose)
|
|
||||||
{
|
|
||||||
Info<< "Writing geometry to " << surfaceDir << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Points
|
|
||||||
OFstream(surfaceDir/"points")() << points;
|
|
||||||
|
|
||||||
// Faces
|
|
||||||
OFstream(surfaceDir/"faces")() << faces;
|
|
||||||
|
|
||||||
// Face centers. Not really necessary but very handy when reusing as inputs
|
|
||||||
// for e.g. timeVaryingMapped bc.
|
|
||||||
pointField faceCentres(faces.size(),point::zero);
|
|
||||||
|
|
||||||
forAll (faces, faceI)
|
|
||||||
{
|
|
||||||
faceCentres[faceI] = faces[faceI].centre(points);
|
|
||||||
}
|
|
||||||
|
|
||||||
OFstream(surfaceDir/"faceCentres")() << faceCentres;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::foamFileSurfaceWriter<Type>::write
|
void Foam::foamFileSurfaceWriter::writeTemplate
|
||||||
(
|
(
|
||||||
const fileName& outputDir,
|
const fileName& outputDir,
|
||||||
const fileName& surfaceName,
|
const fileName& surfaceName,
|
||||||
@ -113,7 +66,6 @@ void Foam::foamFileSurfaceWriter<Type>::write
|
|||||||
}
|
}
|
||||||
|
|
||||||
// geometry should already have been written
|
// geometry should already have been written
|
||||||
|
|
||||||
// Values to separate directory (e.g. "scalarField/p")
|
// Values to separate directory (e.g. "scalarField/p")
|
||||||
|
|
||||||
fileName foamName(pTraits<Type>::typeName);
|
fileName foamName(pTraits<Type>::typeName);
|
||||||
@ -125,8 +77,69 @@ void Foam::foamFileSurfaceWriter<Type>::write
|
|||||||
}
|
}
|
||||||
|
|
||||||
// values
|
// values
|
||||||
OFstream(valuesDir/fieldName)() << values;
|
OFstream(valuesDir/fieldName)() << values;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::foamFileSurfaceWriter::foamFileSurfaceWriter()
|
||||||
|
:
|
||||||
|
surfaceWriter()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::foamFileSurfaceWriter::~foamFileSurfaceWriter()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::foamFileSurfaceWriter::write
|
||||||
|
(
|
||||||
|
const fileName& outputDir,
|
||||||
|
const fileName& surfaceName,
|
||||||
|
const pointField& points,
|
||||||
|
const faceList& faces,
|
||||||
|
const bool verbose
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
fileName surfaceDir(outputDir/surfaceName);
|
||||||
|
|
||||||
|
if (!isDir(surfaceDir))
|
||||||
|
{
|
||||||
|
mkDir(surfaceDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (verbose)
|
||||||
|
{
|
||||||
|
Info<< "Writing geometry to " << surfaceDir << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Points
|
||||||
|
OFstream(surfaceDir/"points")() << points;
|
||||||
|
|
||||||
|
// Faces
|
||||||
|
OFstream(surfaceDir/"faces")() << faces;
|
||||||
|
|
||||||
|
// Face centers. Not really necessary but very handy when reusing as inputs
|
||||||
|
// for e.g. timeVaryingMapped bc.
|
||||||
|
pointField faceCentres(faces.size(),point::zero);
|
||||||
|
|
||||||
|
forAll(faces, faceI)
|
||||||
|
{
|
||||||
|
faceCentres[faceI] = faces[faceI].centre(points);
|
||||||
|
}
|
||||||
|
|
||||||
|
OFstream(surfaceDir/"faceCentres")() << faceCentres;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// create write methods
|
||||||
|
defineSurfaceWriterWriteFields(Foam::foamFileSurfaceWriter);
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -43,14 +43,29 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class foamFileSurfaceWriter Declaration
|
Class foamFileSurfaceWriter Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
class foamFileSurfaceWriter
|
class foamFileSurfaceWriter
|
||||||
:
|
:
|
||||||
public surfaceWriter<Type>
|
public surfaceWriter
|
||||||
{
|
{
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Templated write operation
|
||||||
|
template<class Type>
|
||||||
|
void writeTemplate
|
||||||
|
(
|
||||||
|
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;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -70,13 +85,14 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Return true if the surface format supports separate files
|
//- True if the surface format supports geometry in a separate file.
|
||||||
virtual bool separateFiles()
|
// False if geometry and field must be in a single file
|
||||||
|
virtual bool separateGeometry()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Write geometry to file.
|
//- Write single surface geometry to file.
|
||||||
virtual void write
|
virtual void write
|
||||||
(
|
(
|
||||||
const fileName& outputDir,
|
const fileName& outputDir,
|
||||||
@ -86,18 +102,77 @@ public:
|
|||||||
const bool verbose = false
|
const bool verbose = false
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Writes single surface to file.
|
|
||||||
|
//- Write scalarField for a single surface to file.
|
||||||
|
// One value per face or vertex (isNodeValues = true)
|
||||||
virtual void write
|
virtual void write
|
||||||
(
|
(
|
||||||
const fileName& outputDir,
|
const fileName& outputDir, // <root>/<case>/surface/TIME
|
||||||
const fileName& surfaceName,
|
const fileName& surfaceName, // name of surface
|
||||||
const pointField& points,
|
const pointField& points,
|
||||||
const faceList& faces,
|
const faceList& faces,
|
||||||
const word& fieldName,
|
const word& fieldName, // name of field
|
||||||
const Field<Type>& values,
|
const Field<scalar>& values,
|
||||||
const bool isNodeValues,
|
const bool isNodeValues,
|
||||||
const bool verbose = false
|
const bool verbose = false
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
//- Write vectorField for a single surface to file.
|
||||||
|
// One value per face or vertex (isNodeValues = true)
|
||||||
|
virtual void write
|
||||||
|
(
|
||||||
|
const fileName& outputDir, // <root>/<case>/surface/TIME
|
||||||
|
const fileName& surfaceName, // name of surface
|
||||||
|
const pointField& points,
|
||||||
|
const faceList& faces,
|
||||||
|
const word& fieldName, // name of field
|
||||||
|
const Field<vector>& values,
|
||||||
|
const bool isNodeValues,
|
||||||
|
const bool verbose = false
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Write sphericalTensorField for a single surface to file.
|
||||||
|
// One value per face or vertex (isNodeValues = true)
|
||||||
|
virtual void write
|
||||||
|
(
|
||||||
|
const fileName& outputDir, // <root>/<case>/surface/TIME
|
||||||
|
const fileName& surfaceName, // name of surface
|
||||||
|
const pointField& points,
|
||||||
|
const faceList& faces,
|
||||||
|
const word& fieldName, // name of field
|
||||||
|
const Field<sphericalTensor>& values,
|
||||||
|
const bool isNodeValues,
|
||||||
|
const bool verbose = false
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Write symmTensorField for a single surface to file.
|
||||||
|
// One value per face or vertex (isNodeValues = true)
|
||||||
|
virtual void write
|
||||||
|
(
|
||||||
|
const fileName& outputDir, // <root>/<case>/surface/TIME
|
||||||
|
const fileName& surfaceName, // name of surface
|
||||||
|
const pointField& points,
|
||||||
|
const faceList& faces,
|
||||||
|
const word& fieldName, // name of field
|
||||||
|
const Field<symmTensor>& values,
|
||||||
|
const bool isNodeValues,
|
||||||
|
const bool verbose = false
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Write tensorField for a single surface to file.
|
||||||
|
// One value per face or vertex (isNodeValues = true)
|
||||||
|
virtual void write
|
||||||
|
(
|
||||||
|
const fileName& outputDir, // <root>/<case>/surface/TIME
|
||||||
|
const fileName& surfaceName, // name of surface
|
||||||
|
const pointField& points,
|
||||||
|
const faceList& faces,
|
||||||
|
const word& fieldName, // name of field
|
||||||
|
const Field<tensor>& values,
|
||||||
|
const bool isNodeValues,
|
||||||
|
const bool verbose = false
|
||||||
|
) const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -107,12 +182,6 @@ public:
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#ifdef NoRepository
|
|
||||||
# include "foamFileSurfaceWriter.C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -1,44 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2004-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 "foamFileSurfaceWriter.H"
|
|
||||||
#include "surfaceWriters.H"
|
|
||||||
#include "addToRunTimeSelectionTable.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
makeSurfaceWriterType(foamFileSurfaceWriter, bool);
|
|
||||||
makeSurfaceWriters(foamFileSurfaceWriter);
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -0,0 +1,92 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011-2011 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/>.
|
||||||
|
|
||||||
|
InClass
|
||||||
|
Foam::makeSurfaceWriterMethods
|
||||||
|
|
||||||
|
Description
|
||||||
|
Convenience macros for instantiating writer methods for surfaceWriter
|
||||||
|
classes.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef makeSurfaceWriterMethods_H
|
||||||
|
#define makeSurfaceWriterMethods_H
|
||||||
|
|
||||||
|
#include "surfaceWriter.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#define makeSurfaceWriterType(ThisClass) \
|
||||||
|
defineTypeNameAndDebug(ThisClass, 0); \
|
||||||
|
addToRunTimeSelectionTable(surfaceWriter, ThisClass, word)
|
||||||
|
|
||||||
|
|
||||||
|
#define defineSurfaceWriterWriteField(ThisClass, FieldType) \
|
||||||
|
void ThisClass::write \
|
||||||
|
( \
|
||||||
|
const fileName& outputDir, \
|
||||||
|
const fileName& surfaceName, \
|
||||||
|
const pointField& points, \
|
||||||
|
const faceList& faces, \
|
||||||
|
const word& fieldName, \
|
||||||
|
const Field<FieldType>& values, \
|
||||||
|
const bool isNodeValues, \
|
||||||
|
const bool verbose \
|
||||||
|
) const \
|
||||||
|
{ \
|
||||||
|
writeTemplate \
|
||||||
|
( \
|
||||||
|
outputDir, \
|
||||||
|
surfaceName, \
|
||||||
|
points, \
|
||||||
|
faces, \
|
||||||
|
fieldName, \
|
||||||
|
values, \
|
||||||
|
isNodeValues, \
|
||||||
|
verbose \
|
||||||
|
); \
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define defineSurfaceWriterWriteFields(ThisClass) \
|
||||||
|
defineSurfaceWriterWriteField(ThisClass, scalar); \
|
||||||
|
defineSurfaceWriterWriteField(ThisClass, vector); \
|
||||||
|
defineSurfaceWriterWriteField(ThisClass, sphericalTensor); \
|
||||||
|
defineSurfaceWriterWriteField(ThisClass, symmTensor); \
|
||||||
|
defineSurfaceWriterWriteField(ThisClass, tensor)
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -1,63 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2004-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 "nullSurfaceWriter.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Foam::nullSurfaceWriter<Type>::nullSurfaceWriter()
|
|
||||||
:
|
|
||||||
surfaceWriter<Type>()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Foam::nullSurfaceWriter<Type>::~nullSurfaceWriter()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::nullSurfaceWriter<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
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,103 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2004-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::nullSurfaceWriter
|
|
||||||
|
|
||||||
Description
|
|
||||||
|
|
||||||
SourceFiles
|
|
||||||
nullSurfaceWriter.C
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef nullSurfaceWriter_H
|
|
||||||
#define nullSurfaceWriter_H
|
|
||||||
|
|
||||||
#include "surfaceWriter.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
Class nullSurfaceWriter Declaration
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
class nullSurfaceWriter
|
|
||||||
:
|
|
||||||
public surfaceWriter<Type>
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
//- Runtime type information
|
|
||||||
TypeName("null");
|
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
//- Construct null
|
|
||||||
nullSurfaceWriter();
|
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
|
||||||
virtual ~nullSurfaceWriter();
|
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
|
||||||
|
|
||||||
// Write
|
|
||||||
|
|
||||||
//- 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 "nullSurfaceWriter.C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,44 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2004-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 "nullSurfaceWriter.H"
|
|
||||||
#include "surfaceWriters.H"
|
|
||||||
#include "addToRunTimeSelectionTable.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
makeSurfaceWriterType(nullSurfaceWriter, bool);
|
|
||||||
makeSurfaceWriters(nullSurfaceWriter);
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -29,27 +29,34 @@ License
|
|||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
#include "OSspecific.H"
|
#include "OSspecific.H"
|
||||||
|
|
||||||
|
#include "makeSurfaceWriterMethods.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(proxySurfaceWriter, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
Foam::proxySurfaceWriter::proxySurfaceWriter(const word& ext)
|
||||||
Foam::proxySurfaceWriter<Type>::proxySurfaceWriter(const word& ext)
|
|
||||||
:
|
:
|
||||||
surfaceWriter<Type>(),
|
surfaceWriter(),
|
||||||
ext_(ext)
|
ext_(ext)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
Foam::proxySurfaceWriter::~proxySurfaceWriter()
|
||||||
Foam::proxySurfaceWriter<Type>::~proxySurfaceWriter()
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
void Foam::proxySurfaceWriter::write
|
||||||
void Foam::proxySurfaceWriter<Type>::write
|
|
||||||
(
|
(
|
||||||
const fileName& outputDir,
|
const fileName& outputDir,
|
||||||
const fileName& surfaceName,
|
const fileName& surfaceName,
|
||||||
@ -69,19 +76,14 @@ void Foam::proxySurfaceWriter<Type>::write
|
|||||||
mkDir(outputDir);
|
mkDir(outputDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
fileName fName(outputDir/surfaceName + "." + ext_);
|
fileName outName(outputDir/surfaceName + "." + ext_);
|
||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
{
|
{
|
||||||
Info<< "Writing geometry to " << fName << endl;
|
Info<< "Writing geometry to " << outName << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
MeshedSurfaceProxy<face>
|
MeshedSurfaceProxy<face>(points, faces).write(outName);
|
||||||
(
|
|
||||||
points,
|
|
||||||
faces
|
|
||||||
).write(fName);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -25,6 +25,8 @@ Class
|
|||||||
Foam::proxySurfaceWriter
|
Foam::proxySurfaceWriter
|
||||||
|
|
||||||
Description
|
Description
|
||||||
|
A surfaceWriter that writes the geometry via the MeshedSurfaceProxy, but
|
||||||
|
which does not support any fields.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
proxySurfaceWriter.C
|
proxySurfaceWriter.C
|
||||||
@ -42,13 +44,12 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class proxySurfaceWriter Declaration
|
Class proxySurfaceWriter Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
class proxySurfaceWriter
|
class proxySurfaceWriter
|
||||||
:
|
:
|
||||||
public surfaceWriter<Type>
|
public surfaceWriter
|
||||||
{
|
{
|
||||||
|
|
||||||
// Private data
|
// Private data
|
||||||
@ -74,15 +75,16 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Always write separate geometry file
|
|
||||||
virtual bool separateFiles()
|
//- True if the surface format supports geometry in a separate file.
|
||||||
|
// False if geometry and field must be in a single file
|
||||||
|
virtual bool separateGeometry()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write
|
|
||||||
|
|
||||||
//- Write geometry to file.
|
//- Write single surface geometry to file.
|
||||||
virtual void write
|
virtual void write
|
||||||
(
|
(
|
||||||
const fileName& outputDir,
|
const fileName& outputDir,
|
||||||
@ -92,20 +94,6 @@ public:
|
|||||||
const bool verbose = false
|
const bool verbose = false
|
||||||
) const;
|
) 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
|
|
||||||
{}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -115,12 +103,6 @@ public:
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#ifdef NoRepository
|
|
||||||
# include "proxySurfaceWriter.C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -1,45 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2004-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 "proxySurfaceWriter.H"
|
|
||||||
#include "surfaceWriters.H"
|
|
||||||
#include "addToRunTimeSelectionTable.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
// create type names, but do not register with run-time tables
|
|
||||||
makeTypeSurfaceWritersTypeName(proxySurfaceWriter, bool);
|
|
||||||
makeSurfaceWritersTypeName(proxySurfaceWriter);
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -29,334 +29,187 @@ License
|
|||||||
#include "OSspecific.H"
|
#include "OSspecific.H"
|
||||||
#include "IOmanip.H"
|
#include "IOmanip.H"
|
||||||
|
|
||||||
|
#include "makeSurfaceWriterMethods.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
makeSurfaceWriterType(rawSurfaceWriter);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
inline void Foam::rawSurfaceWriter::writeLocation
|
||||||
void Foam::rawSurfaceWriter<Type>::writeGeometry
|
|
||||||
(
|
(
|
||||||
|
Ostream& os,
|
||||||
const pointField& points,
|
const pointField& points,
|
||||||
const label pointI,
|
const label pointI
|
||||||
Ostream& os
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const point& pt = points[pointI];
|
const point& pt = points[pointI];
|
||||||
|
os << pt.x() << ' ' << pt.y() << ' ' << pt.z() << ' ';
|
||||||
os << pt.x() << ' ' << pt.y() << ' ' << pt.z() << ' ';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
inline void Foam::rawSurfaceWriter::writeLocation
|
||||||
void Foam::rawSurfaceWriter<Type>::writeGeometry
|
|
||||||
(
|
(
|
||||||
|
Ostream& os,
|
||||||
const pointField& points,
|
const pointField& points,
|
||||||
const faceList& faces,
|
const faceList& faces,
|
||||||
const label faceI,
|
const label faceI
|
||||||
Ostream& os
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const point& ct = faces[faceI].centre(points);
|
const point& ct = faces[faceI].centre(points);
|
||||||
|
os << ct.x() << ' ' << ct.y() << ' ' << ct.z() << ' ';
|
||||||
os << ct.x() << ' ' << ct.y() << ' ' << ct.z() << ' ';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Write scalarField in raw format
|
|
||||||
template<class Type>
|
|
||||||
void Foam::rawSurfaceWriter<Type>::writeData
|
|
||||||
(
|
|
||||||
const word& fieldName,
|
|
||||||
const pointField& points,
|
|
||||||
const faceList& faces,
|
|
||||||
const scalarField& values,
|
|
||||||
const bool isNodeValues,
|
|
||||||
Ostream& os
|
|
||||||
)
|
|
||||||
{
|
|
||||||
// header
|
|
||||||
os << "# x y z " << fieldName << endl;
|
|
||||||
|
|
||||||
// Write data
|
|
||||||
if (isNodeValues)
|
|
||||||
{
|
|
||||||
forAll(values, elemI)
|
|
||||||
{
|
|
||||||
writeGeometry(points, elemI, os);
|
|
||||||
os << values[elemI] << nl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
forAll(values, elemI)
|
|
||||||
{
|
|
||||||
writeGeometry(points, faces, elemI, os);
|
|
||||||
os << values[elemI] << nl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
os << nl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Write vectorField in raw format
|
|
||||||
template<class Type>
|
|
||||||
void Foam::rawSurfaceWriter<Type>::writeData
|
|
||||||
(
|
|
||||||
const word& fieldName,
|
|
||||||
const pointField& points,
|
|
||||||
const faceList& faces,
|
|
||||||
const vectorField& values,
|
|
||||||
const bool isNodeValues,
|
|
||||||
Ostream& os
|
|
||||||
)
|
|
||||||
{
|
|
||||||
// header
|
|
||||||
os << "# x y z "
|
|
||||||
<< fieldName << "_x "
|
|
||||||
<< fieldName << "_y "
|
|
||||||
<< fieldName << "_z "
|
|
||||||
<< endl;
|
|
||||||
|
|
||||||
// Write data
|
|
||||||
if (isNodeValues)
|
|
||||||
{
|
|
||||||
forAll(values, elemI)
|
|
||||||
{
|
|
||||||
writeGeometry(points, elemI, os);
|
|
||||||
|
|
||||||
const vector& v = values[elemI];
|
|
||||||
os << v[0] << ' ' << v[1] << ' ' << v[2] << nl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
forAll(values, elemI)
|
|
||||||
{
|
|
||||||
writeGeometry(points, faces, elemI, os);
|
|
||||||
|
|
||||||
const vector& v = values[elemI];
|
|
||||||
os << v[0] << ' ' << v[1] << ' ' << v[2] << nl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Write sphericalTensorField in raw format
|
|
||||||
template<class Type>
|
|
||||||
void Foam::rawSurfaceWriter<Type>::writeData
|
|
||||||
(
|
|
||||||
const word& fieldName,
|
|
||||||
const pointField& points,
|
|
||||||
const faceList& faces,
|
|
||||||
const sphericalTensorField& values,
|
|
||||||
const bool isNodeValues,
|
|
||||||
Ostream& os
|
|
||||||
)
|
|
||||||
{
|
|
||||||
// header
|
|
||||||
os << "# ii ";
|
|
||||||
os << fieldName << "_ii" << endl;
|
|
||||||
|
|
||||||
// Write data
|
|
||||||
if (isNodeValues)
|
|
||||||
{
|
|
||||||
forAll(values, elemI)
|
|
||||||
{
|
|
||||||
writeGeometry(points, elemI, os);
|
|
||||||
|
|
||||||
const sphericalTensor& v = values[elemI];
|
|
||||||
os << v[0] << nl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
forAll(values, elemI)
|
|
||||||
{
|
|
||||||
writeGeometry(points, faces, elemI, os);
|
|
||||||
|
|
||||||
const sphericalTensor& v = values[elemI];
|
|
||||||
os << v[0] << nl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Write symmTensorField in raw format
|
|
||||||
template<class Type>
|
|
||||||
void Foam::rawSurfaceWriter<Type>::writeData
|
|
||||||
(
|
|
||||||
const word& fieldName,
|
|
||||||
const pointField& points,
|
|
||||||
const faceList& faces,
|
|
||||||
const symmTensorField& values,
|
|
||||||
const bool isNodeValues,
|
|
||||||
Ostream& os
|
|
||||||
)
|
|
||||||
{
|
|
||||||
// header
|
|
||||||
os << "# xx xy xz yy yz ";
|
|
||||||
for (int i=0; i<6; i++)
|
|
||||||
{
|
|
||||||
os << fieldName << "_" << i << " ";
|
|
||||||
}
|
|
||||||
os << endl;
|
|
||||||
|
|
||||||
// Write data
|
|
||||||
if (isNodeValues)
|
|
||||||
{
|
|
||||||
forAll(values, elemI)
|
|
||||||
{
|
|
||||||
writeGeometry(points, elemI, os);
|
|
||||||
|
|
||||||
const symmTensor& v = values[elemI];
|
|
||||||
|
|
||||||
os << v[0] << ' ' << v[1] << ' ' << v[2] << ' '
|
|
||||||
<< v[3] << ' ' << v[4] << ' ' << v[5] << nl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
forAll(values, elemI)
|
|
||||||
{
|
|
||||||
writeGeometry(points, faces, elemI, os);
|
|
||||||
|
|
||||||
const symmTensor& v = values[elemI];
|
|
||||||
|
|
||||||
os << v[0] << ' ' << v[1] << ' ' << v[2] << ' '
|
|
||||||
<< v[3] << ' ' << v[4] << ' ' << v[5] << nl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Write tensorField in raw format
|
|
||||||
template<class Type>
|
|
||||||
void Foam::rawSurfaceWriter<Type>::writeData
|
|
||||||
(
|
|
||||||
const word& fieldName,
|
|
||||||
const pointField& points,
|
|
||||||
const faceList& faces,
|
|
||||||
const tensorField& values,
|
|
||||||
const bool isNodeValues,
|
|
||||||
Ostream& os
|
|
||||||
)
|
|
||||||
{
|
|
||||||
// header
|
|
||||||
os << "# xx xy xz yx yy yz zx zy zz";
|
|
||||||
for (int i=0; i<9; ++i)
|
|
||||||
{
|
|
||||||
os << fieldName << "_" << i << " ";
|
|
||||||
}
|
|
||||||
os << endl;
|
|
||||||
|
|
||||||
// Write data
|
|
||||||
if (isNodeValues)
|
|
||||||
{
|
|
||||||
forAll(values, elemI)
|
|
||||||
{
|
|
||||||
writeGeometry(points, elemI, os);
|
|
||||||
|
|
||||||
const tensor& v = values[elemI];
|
|
||||||
os << v[0] << ' ' << v[1] << ' ' << v[2] << ' '
|
|
||||||
<< v[3] << ' ' << v[4] << ' ' << v[5] << ' '
|
|
||||||
<< v[6] << ' ' << v[7] << ' ' << v[8] << nl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
forAll(values, elemI)
|
|
||||||
{
|
|
||||||
writeGeometry(points, faces, elemI, os);
|
|
||||||
|
|
||||||
const tensor& v = values[elemI];
|
|
||||||
os << v[0] << ' ' << v[1] << ' ' << v[2] << ' '
|
|
||||||
<< v[3] << ' ' << v[4] << ' ' << v[5] << ' '
|
|
||||||
<< v[6] << ' ' << v[7] << ' ' << v[8] << nl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Foam::rawSurfaceWriter<Type>::rawSurfaceWriter()
|
|
||||||
:
|
|
||||||
surfaceWriter<Type>()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Foam::rawSurfaceWriter<Type>::~rawSurfaceWriter()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::rawSurfaceWriter<Type>::write
|
|
||||||
(
|
|
||||||
const fileName& outputDir,
|
|
||||||
const fileName& surfaceName,
|
|
||||||
const pointField& points,
|
|
||||||
const faceList& faces,
|
|
||||||
const bool verbose
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
if (!isDir(outputDir))
|
|
||||||
{
|
|
||||||
mkDir(outputDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
OFstream os
|
|
||||||
(
|
|
||||||
outputDir/surfaceName + ".raw"
|
|
||||||
);
|
|
||||||
|
|
||||||
if (verbose)
|
|
||||||
{
|
|
||||||
Info<< "Writing geometry to " << os.name() << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// header
|
|
||||||
os << "# geometry NO_DATA " << faces.size() << nl
|
|
||||||
<< "# x y z" << endl;
|
|
||||||
|
|
||||||
// Write faces
|
|
||||||
forAll(faces, elemI)
|
|
||||||
{
|
|
||||||
writeGeometry(points, faces, elemI, os);
|
|
||||||
os << nl;
|
|
||||||
}
|
|
||||||
|
|
||||||
os << nl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
// bool fields aren't supported
|
|
||||||
template<>
|
template<>
|
||||||
void Foam::rawSurfaceWriter<bool>::write
|
void Foam::rawSurfaceWriter::writeHeader
|
||||||
(
|
(
|
||||||
const fileName& outputDir,
|
Ostream& os,
|
||||||
const fileName& surfaceName,
|
|
||||||
const pointField& points,
|
|
||||||
const faceList& faces,
|
|
||||||
const word& fieldName,
|
const word& fieldName,
|
||||||
const Field<bool>& values,
|
const Field<scalar>& values
|
||||||
const bool isNodeValues,
|
)
|
||||||
const bool verbose
|
{
|
||||||
) const
|
os << values.size() << nl
|
||||||
{}
|
<< "# x y z " << fieldName << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void Foam::rawSurfaceWriter::writeHeader
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const word& fieldName,
|
||||||
|
const Field<vector>& values
|
||||||
|
)
|
||||||
|
{
|
||||||
|
os << values.size() << nl
|
||||||
|
<< "# x y z "
|
||||||
|
<< fieldName << "_x "
|
||||||
|
<< fieldName << "_y "
|
||||||
|
<< fieldName << "_z "
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void Foam::rawSurfaceWriter::writeHeader
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const word& fieldName,
|
||||||
|
const Field<sphericalTensor>& values
|
||||||
|
)
|
||||||
|
{
|
||||||
|
os << values.size() << nl
|
||||||
|
<< "# ii "
|
||||||
|
<< fieldName << "_ii" << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void Foam::rawSurfaceWriter::writeHeader
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const word& fieldName,
|
||||||
|
const Field<symmTensor>& values
|
||||||
|
)
|
||||||
|
{
|
||||||
|
os << values.size() << nl
|
||||||
|
<< "# xx xy xz yy yz ";
|
||||||
|
for (int i=0; i<6; ++i)
|
||||||
|
{
|
||||||
|
os << fieldName << "_" << i << " ";
|
||||||
|
}
|
||||||
|
os << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void Foam::rawSurfaceWriter::writeHeader
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const word& fieldName,
|
||||||
|
const Field<tensor>& values
|
||||||
|
)
|
||||||
|
{
|
||||||
|
os << values.size() << nl
|
||||||
|
<< "# xx xy xz yx yy yz zx zy zz";
|
||||||
|
for (int i=0; i<9; ++i)
|
||||||
|
{
|
||||||
|
os << fieldName << "_" << i << " ";
|
||||||
|
}
|
||||||
|
os << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<>
|
||||||
|
inline void Foam::rawSurfaceWriter::writeData
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const scalar& v
|
||||||
|
)
|
||||||
|
{
|
||||||
|
os << v << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<>
|
||||||
|
inline void Foam::rawSurfaceWriter::writeData
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const vector& v
|
||||||
|
)
|
||||||
|
{
|
||||||
|
os << v[0] << ' ' << v[1] << ' ' << v[2] << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<>
|
||||||
|
inline void Foam::rawSurfaceWriter::writeData
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const sphericalTensor& v
|
||||||
|
)
|
||||||
|
{
|
||||||
|
os << v[0] << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<>
|
||||||
|
inline void Foam::rawSurfaceWriter::writeData
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const symmTensor& v
|
||||||
|
)
|
||||||
|
{
|
||||||
|
os << v[0] << ' ' << v[1] << ' ' << v[2] << ' '
|
||||||
|
<< v[3] << ' ' << v[4] << ' ' << v[5] << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<>
|
||||||
|
inline void Foam::rawSurfaceWriter::writeData
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const tensor& v
|
||||||
|
)
|
||||||
|
{
|
||||||
|
os << v[0] << ' ' << v[1] << ' ' << v[2] << ' '
|
||||||
|
<< v[3] << ' ' << v[4] << ' ' << v[5] << ' '
|
||||||
|
<< v[6] << ' ' << v[7] << ' ' << v[8] << nl;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::rawSurfaceWriter<Type>::write
|
void Foam::rawSurfaceWriter::writeTemplate
|
||||||
(
|
(
|
||||||
const fileName& outputDir,
|
const fileName& outputDir,
|
||||||
const fileName& surfaceName,
|
const fileName& surfaceName,
|
||||||
@ -373,17 +226,13 @@ void Foam::rawSurfaceWriter<Type>::write
|
|||||||
mkDir(outputDir);
|
mkDir(outputDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
OFstream os
|
OFstream os(outputDir/fieldName + '_' + surfaceName + ".raw");
|
||||||
(
|
|
||||||
outputDir/fieldName + '_' + surfaceName + ".raw"
|
|
||||||
);
|
|
||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
{
|
{
|
||||||
Info<< "Writing field " << fieldName << " to " << os.name() << endl;
|
Info<< "Writing field " << fieldName << " to " << os.name() << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// header
|
// header
|
||||||
os << "# " << fieldName;
|
os << "# " << fieldName;
|
||||||
if (isNodeValues)
|
if (isNodeValues)
|
||||||
@ -395,10 +244,85 @@ void Foam::rawSurfaceWriter<Type>::write
|
|||||||
os << " FACE_DATA ";
|
os << " FACE_DATA ";
|
||||||
}
|
}
|
||||||
|
|
||||||
os << values.size() << nl;
|
// header
|
||||||
|
writeHeader(os, fieldName, values);
|
||||||
|
|
||||||
writeData(fieldName, points, faces, values, isNodeValues, os);
|
// values
|
||||||
|
if (isNodeValues)
|
||||||
|
{
|
||||||
|
forAll(values, elemI)
|
||||||
|
{
|
||||||
|
writeLocation(os, points, elemI);
|
||||||
|
writeData(os, values[elemI]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
forAll(values, elemI)
|
||||||
|
{
|
||||||
|
writeLocation(os, points, faces, elemI);
|
||||||
|
writeData(os, values[elemI]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::rawSurfaceWriter::rawSurfaceWriter()
|
||||||
|
:
|
||||||
|
surfaceWriter()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::rawSurfaceWriter::~rawSurfaceWriter()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::rawSurfaceWriter::write
|
||||||
|
(
|
||||||
|
const fileName& outputDir,
|
||||||
|
const fileName& surfaceName,
|
||||||
|
const pointField& points,
|
||||||
|
const faceList& faces,
|
||||||
|
const bool verbose
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (!isDir(outputDir))
|
||||||
|
{
|
||||||
|
mkDir(outputDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
OFstream os(outputDir/surfaceName + ".raw");
|
||||||
|
|
||||||
|
if (verbose)
|
||||||
|
{
|
||||||
|
Info<< "Writing geometry to " << os.name() << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// header
|
||||||
|
os << "# geometry NO_DATA " << faces.size() << nl
|
||||||
|
<< "# x y z" << nl;
|
||||||
|
|
||||||
|
// Write faces centres
|
||||||
|
forAll(faces, elemI)
|
||||||
|
{
|
||||||
|
writeLocation(os, points, faces, elemI);
|
||||||
|
os << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
os << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// create write methods
|
||||||
|
defineSurfaceWriterWriteFields(Foam::rawSurfaceWriter);
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -25,6 +25,7 @@ Class
|
|||||||
Foam::rawSurfaceWriter
|
Foam::rawSurfaceWriter
|
||||||
|
|
||||||
Description
|
Description
|
||||||
|
A surfaceWriter for raw output.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
rawSurfaceWriter.C
|
rawSurfaceWriter.C
|
||||||
@ -36,86 +37,62 @@ SourceFiles
|
|||||||
|
|
||||||
#include "surfaceWriter.H"
|
#include "surfaceWriter.H"
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class raw Declaration
|
Class rawSurfaceWriter Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
class rawSurfaceWriter
|
class rawSurfaceWriter
|
||||||
:
|
:
|
||||||
public surfaceWriter<Type>
|
public surfaceWriter
|
||||||
{
|
{
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
static void writeGeometry
|
static inline void writeLocation
|
||||||
(
|
(
|
||||||
const pointField& points,
|
Ostream&,
|
||||||
const label pointI,
|
const pointField&,
|
||||||
Ostream& os
|
const label pointI
|
||||||
);
|
);
|
||||||
|
|
||||||
static void writeGeometry
|
static inline void writeLocation
|
||||||
(
|
(
|
||||||
const pointField& points,
|
Ostream&,
|
||||||
const faceList& faces,
|
const pointField&,
|
||||||
const label faceI,
|
const faceList&,
|
||||||
Ostream& os
|
const label faceI
|
||||||
);
|
);
|
||||||
|
|
||||||
static void writeData
|
template<class Type>
|
||||||
|
static void writeHeader
|
||||||
(
|
(
|
||||||
|
Ostream&,
|
||||||
const word& fieldName,
|
const word& fieldName,
|
||||||
const pointField& points,
|
const Field<Type>&
|
||||||
const faceList& faces,
|
|
||||||
const scalarField& values,
|
|
||||||
const bool isNodeValues,
|
|
||||||
Ostream& os
|
|
||||||
);
|
);
|
||||||
|
|
||||||
static void writeData
|
template<class Type>
|
||||||
(
|
static inline void writeData(Ostream&, const Type&);
|
||||||
const word& fieldName,
|
|
||||||
const pointField& points,
|
|
||||||
const faceList& faces,
|
|
||||||
const vectorField& values,
|
|
||||||
const bool isNodeValues,
|
|
||||||
Ostream& os
|
|
||||||
);
|
|
||||||
|
|
||||||
static void writeData
|
|
||||||
(
|
|
||||||
const word& fieldName,
|
|
||||||
const pointField& points,
|
|
||||||
const faceList& faces,
|
|
||||||
const sphericalTensorField& values,
|
|
||||||
const bool isNodeValues,
|
|
||||||
Ostream& os
|
|
||||||
);
|
|
||||||
|
|
||||||
static void writeData
|
//- Templated write operation
|
||||||
|
template<class Type>
|
||||||
|
void writeTemplate
|
||||||
(
|
(
|
||||||
const word& fieldName,
|
const fileName& outputDir,
|
||||||
|
const fileName& surfaceName,
|
||||||
const pointField& points,
|
const pointField& points,
|
||||||
const faceList& faces,
|
const faceList& faces,
|
||||||
const symmTensorField& values,
|
|
||||||
const bool isNodeValues,
|
|
||||||
Ostream& os
|
|
||||||
);
|
|
||||||
|
|
||||||
static void writeData
|
|
||||||
(
|
|
||||||
const word& fieldName,
|
const word& fieldName,
|
||||||
const pointField& points,
|
const Field<Type>& values,
|
||||||
const faceList& faces,
|
|
||||||
const tensorField& values,
|
|
||||||
const bool isNodeValues,
|
const bool isNodeValues,
|
||||||
Ostream& os
|
const bool verbose
|
||||||
);
|
) const;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -136,9 +113,7 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
// Write
|
//- Write single surface geometry to file.
|
||||||
|
|
||||||
//- Write geometry to file.
|
|
||||||
virtual void write
|
virtual void write
|
||||||
(
|
(
|
||||||
const fileName& outputDir,
|
const fileName& outputDir,
|
||||||
@ -148,18 +123,77 @@ public:
|
|||||||
const bool verbose = false
|
const bool verbose = false
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Writes single surface to file.
|
|
||||||
|
//- Write scalarField for a single surface to file.
|
||||||
|
// One value per face or vertex (isNodeValues = true)
|
||||||
virtual void write
|
virtual void write
|
||||||
(
|
(
|
||||||
const fileName& outputDir,
|
const fileName& outputDir, // <root>/<case>/surface/TIME
|
||||||
const fileName& surfaceName,
|
const fileName& surfaceName, // name of surface
|
||||||
const pointField& points,
|
const pointField& points,
|
||||||
const faceList& faces,
|
const faceList& faces,
|
||||||
const word& fieldName,
|
const word& fieldName, // name of field
|
||||||
const Field<Type>& values,
|
const Field<scalar>& values,
|
||||||
const bool isNodeValues,
|
const bool isNodeValues,
|
||||||
const bool verbose = false
|
const bool verbose = false
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
//- Write vectorField for a single surface to file.
|
||||||
|
// One value per face or vertex (isNodeValues = true)
|
||||||
|
virtual void write
|
||||||
|
(
|
||||||
|
const fileName& outputDir, // <root>/<case>/surface/TIME
|
||||||
|
const fileName& surfaceName, // name of surface
|
||||||
|
const pointField& points,
|
||||||
|
const faceList& faces,
|
||||||
|
const word& fieldName, // name of field
|
||||||
|
const Field<vector>& values,
|
||||||
|
const bool isNodeValues,
|
||||||
|
const bool verbose = false
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Write sphericalTensorField for a single surface to file.
|
||||||
|
// One value per face or vertex (isNodeValues = true)
|
||||||
|
virtual void write
|
||||||
|
(
|
||||||
|
const fileName& outputDir, // <root>/<case>/surface/TIME
|
||||||
|
const fileName& surfaceName, // name of surface
|
||||||
|
const pointField& points,
|
||||||
|
const faceList& faces,
|
||||||
|
const word& fieldName, // name of field
|
||||||
|
const Field<sphericalTensor>& values,
|
||||||
|
const bool isNodeValues,
|
||||||
|
const bool verbose = false
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Write symmTensorField for a single surface to file.
|
||||||
|
// One value per face or vertex (isNodeValues = true)
|
||||||
|
virtual void write
|
||||||
|
(
|
||||||
|
const fileName& outputDir, // <root>/<case>/surface/TIME
|
||||||
|
const fileName& surfaceName, // name of surface
|
||||||
|
const pointField& points,
|
||||||
|
const faceList& faces,
|
||||||
|
const word& fieldName, // name of field
|
||||||
|
const Field<symmTensor>& values,
|
||||||
|
const bool isNodeValues,
|
||||||
|
const bool verbose = false
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Write tensorField for a single surface to file.
|
||||||
|
// One value per face or vertex (isNodeValues = true)
|
||||||
|
virtual void write
|
||||||
|
(
|
||||||
|
const fileName& outputDir, // <root>/<case>/surface/TIME
|
||||||
|
const fileName& surfaceName, // name of surface
|
||||||
|
const pointField& points,
|
||||||
|
const faceList& faces,
|
||||||
|
const word& fieldName, // name of field
|
||||||
|
const Field<tensor>& values,
|
||||||
|
const bool isNodeValues,
|
||||||
|
const bool verbose = false
|
||||||
|
) const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -169,12 +203,6 @@ public:
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#ifdef NoRepository
|
|
||||||
# include "rawSurfaceWriter.C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -1,44 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2004-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 "rawSurfaceWriter.H"
|
|
||||||
#include "surfaceWriters.H"
|
|
||||||
#include "addToRunTimeSelectionTable.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
makeSurfaceWriterType(rawSurfaceWriter, bool);
|
|
||||||
makeSurfaceWriters(rawSurfaceWriter);
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
172
src/sampling/sampledSurface/writers/starcd/starcdSurfaceWriter.C
Normal file
172
src/sampling/sampledSurface/writers/starcd/starcdSurfaceWriter.C
Normal file
@ -0,0 +1,172 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011-2011 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 "starcdSurfaceWriter.H"
|
||||||
|
|
||||||
|
#include "MeshedSurfaceProxy.H"
|
||||||
|
#include "OFstream.H"
|
||||||
|
#include "OSspecific.H"
|
||||||
|
|
||||||
|
#include "makeSurfaceWriterMethods.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
makeSurfaceWriterType(starcdSurfaceWriter);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
template<>
|
||||||
|
inline void Foam::starcdSurfaceWriter::writeData
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const scalar& v
|
||||||
|
)
|
||||||
|
{
|
||||||
|
os << v << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<>
|
||||||
|
inline void Foam::starcdSurfaceWriter::writeData
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const vector& v
|
||||||
|
)
|
||||||
|
{
|
||||||
|
os << v[0] << ' ' << v[1] << ' ' << v[2] << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<>
|
||||||
|
inline void Foam::starcdSurfaceWriter::writeData
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const sphericalTensor& v
|
||||||
|
)
|
||||||
|
{
|
||||||
|
os << v[0] << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
inline void Foam::starcdSurfaceWriter::writeData
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const Type& v
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::starcdSurfaceWriter::writeTemplate
|
||||||
|
(
|
||||||
|
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))
|
||||||
|
{
|
||||||
|
mkDir(outputDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
OFstream os(outputDir/fieldName + '_' + surfaceName + ".usr");
|
||||||
|
|
||||||
|
if (verbose)
|
||||||
|
{
|
||||||
|
Info<< "Writing field " << fieldName << " to " << os.name() << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// no header, just write values
|
||||||
|
forAll(values, elemI)
|
||||||
|
{
|
||||||
|
os << elemI+1 << ' ';
|
||||||
|
writeData(os, values[elemI]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::starcdSurfaceWriter::starcdSurfaceWriter()
|
||||||
|
:
|
||||||
|
surfaceWriter()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::starcdSurfaceWriter::~starcdSurfaceWriter()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::starcdSurfaceWriter::write
|
||||||
|
(
|
||||||
|
const fileName& outputDir,
|
||||||
|
const fileName& surfaceName,
|
||||||
|
const pointField& points,
|
||||||
|
const faceList& faces,
|
||||||
|
const bool verbose
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (!isDir(outputDir))
|
||||||
|
{
|
||||||
|
mkDir(outputDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
fileName outName(outputDir/surfaceName + ".inp");
|
||||||
|
|
||||||
|
if (verbose)
|
||||||
|
{
|
||||||
|
Info<< "Writing geometry to " << outName << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
MeshedSurfaceProxy<face>(points, faces).write(outName);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// create write methods
|
||||||
|
defineSurfaceWriterWriteField(Foam::starcdSurfaceWriter, scalar);
|
||||||
|
defineSurfaceWriterWriteField(Foam::starcdSurfaceWriter, vector);
|
||||||
|
defineSurfaceWriterWriteField(Foam::starcdSurfaceWriter, sphericalTensor);
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
181
src/sampling/sampledSurface/writers/starcd/starcdSurfaceWriter.H
Normal file
181
src/sampling/sampledSurface/writers/starcd/starcdSurfaceWriter.H
Normal file
@ -0,0 +1,181 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2008-2011 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::starcdSurfaceWriter
|
||||||
|
|
||||||
|
Description
|
||||||
|
A surfaceWriter for STARCD files.
|
||||||
|
|
||||||
|
The geometry is written via the MeshedSurfaceProxy, the fields
|
||||||
|
are written in a trivial ASCII format with ID and VALUE as
|
||||||
|
so-called user data. These @c .usr files can be read into proSTAR
|
||||||
|
with these types of commands. For element data:
|
||||||
|
@verbatim
|
||||||
|
getuser FILENAME.usr cell scalar free
|
||||||
|
getuser FILENAME.usr cell vector free
|
||||||
|
@endverbatim
|
||||||
|
and for vertex data:
|
||||||
|
@verbatim
|
||||||
|
getuser FILENAME.usr vertex scalar free
|
||||||
|
getuser FILENAME.usr vertex vector free
|
||||||
|
@endverbatim
|
||||||
|
|
||||||
|
Note
|
||||||
|
Only scalar and vector fields are supported directly.
|
||||||
|
A sphericalTensor is written as a scalar.
|
||||||
|
Other field types are not written.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
starcdSurfaceWriter.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef starcdSurfaceWriter_H
|
||||||
|
#define starcdSurfaceWriter_H
|
||||||
|
|
||||||
|
#include "surfaceWriter.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class starcdSurfaceWriter Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class starcdSurfaceWriter
|
||||||
|
:
|
||||||
|
public surfaceWriter
|
||||||
|
{
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
static inline void writeData(Ostream&, const Type&);
|
||||||
|
|
||||||
|
|
||||||
|
//- Templated write operation
|
||||||
|
template<class Type>
|
||||||
|
void writeTemplate
|
||||||
|
(
|
||||||
|
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;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("starcd");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct null
|
||||||
|
starcdSurfaceWriter();
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~starcdSurfaceWriter();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- True if the surface format supports geometry in a separate file.
|
||||||
|
// False if geometry and field must be in a single file
|
||||||
|
virtual bool separateGeometry()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Write single surface geometry to file.
|
||||||
|
virtual void write
|
||||||
|
(
|
||||||
|
const fileName& outputDir,
|
||||||
|
const fileName& surfaceName,
|
||||||
|
const pointField& points,
|
||||||
|
const faceList& faces,
|
||||||
|
const bool verbose = false
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Write scalarField for a single surface to file.
|
||||||
|
// One value per face or vertex (isNodeValues = true)
|
||||||
|
virtual void write
|
||||||
|
(
|
||||||
|
const fileName& outputDir, // <root>/<case>/surface/TIME
|
||||||
|
const fileName& surfaceName, // name of surface
|
||||||
|
const pointField& points,
|
||||||
|
const faceList& faces,
|
||||||
|
const word& fieldName, // name of field
|
||||||
|
const Field<scalar>& values,
|
||||||
|
const bool isNodeValues,
|
||||||
|
const bool verbose = false
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Write vectorField for a single surface to file.
|
||||||
|
// One value per face or vertex (isNodeValues = true)
|
||||||
|
virtual void write
|
||||||
|
(
|
||||||
|
const fileName& outputDir, // <root>/<case>/surface/TIME
|
||||||
|
const fileName& surfaceName, // name of surface
|
||||||
|
const pointField& points,
|
||||||
|
const faceList& faces,
|
||||||
|
const word& fieldName, // name of field
|
||||||
|
const Field<vector>& values,
|
||||||
|
const bool isNodeValues,
|
||||||
|
const bool verbose = false
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Write sphericalTensorField for a single surface to file.
|
||||||
|
// One value per face or vertex (isNodeValues = true)
|
||||||
|
virtual void write
|
||||||
|
(
|
||||||
|
const fileName& outputDir, // <root>/<case>/surface/TIME
|
||||||
|
const fileName& surfaceName, // name of surface
|
||||||
|
const pointField& points,
|
||||||
|
const faceList& faces,
|
||||||
|
const word& fieldName, // name of field
|
||||||
|
const Field<sphericalTensor>& values,
|
||||||
|
const bool isNodeValues,
|
||||||
|
const bool verbose = false
|
||||||
|
) const;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -26,47 +26,43 @@ License
|
|||||||
#include "surfaceWriter.H"
|
#include "surfaceWriter.H"
|
||||||
|
|
||||||
#include "MeshedSurfaceProxy.H"
|
#include "MeshedSurfaceProxy.H"
|
||||||
#include "nullSurfaceWriter.H"
|
|
||||||
#include "proxySurfaceWriter.H"
|
#include "proxySurfaceWriter.H"
|
||||||
|
|
||||||
#include "HashTable.H"
|
#include "HashTable.H"
|
||||||
#include "word.H"
|
#include "word.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
namespace Foam
|
||||||
Foam::autoPtr< Foam::surfaceWriter<Type> >
|
|
||||||
Foam::surfaceWriter<Type>::New(const word& writeType)
|
|
||||||
{
|
{
|
||||||
typename wordConstructorTable::iterator cstrIter =
|
defineTypeNameAndDebug(surfaceWriter, 0);
|
||||||
|
defineRunTimeSelectionTable(surfaceWriter, word);
|
||||||
|
addNamedToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
surfaceWriter,
|
||||||
|
surfaceWriter,
|
||||||
|
word,
|
||||||
|
null
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::autoPtr<Foam::surfaceWriter>
|
||||||
|
Foam::surfaceWriter::New(const word& writeType)
|
||||||
|
{
|
||||||
|
wordConstructorTable::iterator cstrIter =
|
||||||
wordConstructorTablePtr_->find(writeType);
|
wordConstructorTablePtr_->find(writeType);
|
||||||
|
|
||||||
if (cstrIter == wordConstructorTablePtr_->end())
|
if (cstrIter == wordConstructorTablePtr_->end())
|
||||||
{
|
{
|
||||||
// not supported for this data type, but it generally does work
|
if (MeshedSurfaceProxy<face>::canWriteType(writeType))
|
||||||
// (it handles the 'bool' specialization - ie, geometry write)
|
|
||||||
if
|
|
||||||
(
|
|
||||||
Foam::surfaceWriter<bool>::wordConstructorTablePtr_->found
|
|
||||||
(
|
|
||||||
writeType
|
|
||||||
)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
// use 'null' handler instead
|
|
||||||
return autoPtr< surfaceWriter<Type> >
|
|
||||||
(
|
|
||||||
new nullSurfaceWriter<Type>()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else if (MeshedSurfaceProxy<face>::canWriteType(writeType))
|
|
||||||
{
|
{
|
||||||
// generally unknown, but can be written via MeshedSurfaceProxy
|
// generally unknown, but can be written via MeshedSurfaceProxy
|
||||||
// use 'proxy' handler instead
|
// use 'proxy' handler instead
|
||||||
return autoPtr< surfaceWriter<Type> >
|
return autoPtr<surfaceWriter>(new proxySurfaceWriter(writeType));
|
||||||
(
|
|
||||||
new proxySurfaceWriter<Type>(writeType)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cstrIter == wordConstructorTablePtr_->end())
|
if (cstrIter == wordConstructorTablePtr_->end())
|
||||||
@ -83,24 +79,20 @@ Foam::surfaceWriter<Type>::New(const word& writeType)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return autoPtr< surfaceWriter<Type> >(cstrIter()());
|
return autoPtr<surfaceWriter>(cstrIter()());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
Foam::surfaceWriter::surfaceWriter()
|
||||||
Foam::surfaceWriter<Type>::surfaceWriter()
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
Foam::surfaceWriter::~surfaceWriter()
|
||||||
Foam::surfaceWriter<Type>::~surfaceWriter()
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -34,7 +34,7 @@ SourceFiles
|
|||||||
#ifndef surfaceWriter_H
|
#ifndef surfaceWriter_H
|
||||||
#define surfaceWriter_H
|
#define surfaceWriter_H
|
||||||
|
|
||||||
#include "Field.H"
|
#include "volFields.H"
|
||||||
#include "typeInfo.H"
|
#include "typeInfo.H"
|
||||||
#include "autoPtr.H"
|
#include "autoPtr.H"
|
||||||
#include "pointField.H"
|
#include "pointField.H"
|
||||||
@ -48,22 +48,12 @@ SourceFiles
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward declaration of friend functions and operators
|
|
||||||
|
|
||||||
template<class Type> class surfaceWriter;
|
|
||||||
template<class Type> class nullSurfaceWriter;
|
|
||||||
template<class Type> class proxySurfaceWriter;
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class surfaceWriter Declaration
|
Class surfaceWriter Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
class surfaceWriter
|
class surfaceWriter
|
||||||
{
|
{
|
||||||
//- friendship between writer data types
|
|
||||||
template<class Type2> friend class surfaceWriter;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
@ -99,14 +89,15 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Return true if the surface format supports separate files
|
//- True if the surface format supports geometry in a separate file.
|
||||||
virtual bool separateFiles()
|
// False if geometry and field must be in a single file
|
||||||
|
virtual bool separateGeometry()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Writes single surface geometry to file.
|
//- Write single surface geometry to file.
|
||||||
virtual void write
|
virtual void write
|
||||||
(
|
(
|
||||||
const fileName& outputDir, // <root>/<case>/surface/TIME
|
const fileName& outputDir, // <root>/<case>/surface/TIME
|
||||||
@ -118,8 +109,8 @@ public:
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
//- Writes single surface to file. Either one value per vertex or
|
//- Write scalarField for a single surface to file.
|
||||||
// one value per face (isNodeValues = false)
|
// One value per face or vertex (isNodeValues = true)
|
||||||
virtual void write
|
virtual void write
|
||||||
(
|
(
|
||||||
const fileName& outputDir, // <root>/<case>/surface/TIME
|
const fileName& outputDir, // <root>/<case>/surface/TIME
|
||||||
@ -127,10 +118,73 @@ public:
|
|||||||
const pointField& points,
|
const pointField& points,
|
||||||
const faceList& faces,
|
const faceList& faces,
|
||||||
const word& fieldName, // name of field
|
const word& fieldName, // name of field
|
||||||
const Field<Type>& values,
|
const Field<scalar>& values,
|
||||||
const bool isNodeValues,
|
const bool isNodeValues,
|
||||||
const bool verbose = false
|
const bool verbose = false
|
||||||
) const = 0;
|
) const
|
||||||
|
{}
|
||||||
|
|
||||||
|
//- Write vectorField for a single surface to file.
|
||||||
|
// One value per face or vertex (isNodeValues = true)
|
||||||
|
virtual void write
|
||||||
|
(
|
||||||
|
const fileName& outputDir, // <root>/<case>/surface/TIME
|
||||||
|
const fileName& surfaceName, // name of surface
|
||||||
|
const pointField& points,
|
||||||
|
const faceList& faces,
|
||||||
|
const word& fieldName, // name of field
|
||||||
|
const Field<vector>& values,
|
||||||
|
const bool isNodeValues,
|
||||||
|
const bool verbose = false
|
||||||
|
) const
|
||||||
|
{}
|
||||||
|
|
||||||
|
//- Write sphericalTensorField for a single surface to file.
|
||||||
|
// One value per face or vertex (isNodeValues = true)
|
||||||
|
virtual void write
|
||||||
|
(
|
||||||
|
const fileName& outputDir, // <root>/<case>/surface/TIME
|
||||||
|
const fileName& surfaceName, // name of surface
|
||||||
|
const pointField& points,
|
||||||
|
const faceList& faces,
|
||||||
|
const word& fieldName, // name of field
|
||||||
|
const Field<sphericalTensor>& values,
|
||||||
|
const bool isNodeValues,
|
||||||
|
const bool verbose = false
|
||||||
|
) const
|
||||||
|
{}
|
||||||
|
|
||||||
|
//- Write symmTensorField for a single surface to file.
|
||||||
|
// One value per face or vertex (isNodeValues = true)
|
||||||
|
virtual void write
|
||||||
|
(
|
||||||
|
const fileName& outputDir, // <root>/<case>/surface/TIME
|
||||||
|
const fileName& surfaceName, // name of surface
|
||||||
|
const pointField& points,
|
||||||
|
const faceList& faces,
|
||||||
|
const word& fieldName, // name of field
|
||||||
|
const Field<symmTensor>& values,
|
||||||
|
const bool isNodeValues,
|
||||||
|
const bool verbose = false
|
||||||
|
) const
|
||||||
|
{}
|
||||||
|
|
||||||
|
//- Write tensorField for a single surface to file.
|
||||||
|
// One value per face or vertex (isNodeValues = true)
|
||||||
|
virtual void write
|
||||||
|
(
|
||||||
|
const fileName& outputDir, // <root>/<case>/surface/TIME
|
||||||
|
const fileName& surfaceName, // name of surface
|
||||||
|
const pointField& points,
|
||||||
|
const faceList& faces,
|
||||||
|
const word& fieldName, // name of field
|
||||||
|
const Field<tensor>& values,
|
||||||
|
const bool isNodeValues,
|
||||||
|
const bool verbose = false
|
||||||
|
) const
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -140,12 +194,6 @@ public:
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#ifdef NoRepository
|
|
||||||
# include "surfaceWriter.C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -1,50 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2004-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 "surfaceWriters.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
|
||||||
#define defineSurfaceWriterType(dataType) \
|
|
||||||
defineNamedTemplateTypeNameAndDebug(surfaceWriter< dataType >, 0); \
|
|
||||||
defineTemplatedRunTimeSelectionTable(surfaceWriter, word, dataType)
|
|
||||||
|
|
||||||
defineSurfaceWriterType(bool);
|
|
||||||
|
|
||||||
defineSurfaceWriterType(scalar);
|
|
||||||
defineSurfaceWriterType(vector);
|
|
||||||
defineSurfaceWriterType(sphericalTensor);
|
|
||||||
defineSurfaceWriterType(symmTensor);
|
|
||||||
defineSurfaceWriterType(tensor);
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,76 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2004-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/>.
|
|
||||||
|
|
||||||
InClass
|
|
||||||
Foam::surfaceWriters
|
|
||||||
|
|
||||||
Description
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef surfaceWriters_H
|
|
||||||
#define surfaceWriters_H
|
|
||||||
|
|
||||||
#include "surfaceWriter.H"
|
|
||||||
#include "fieldTypes.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
// Only used internally
|
|
||||||
#define makeTypeSurfaceWritersTypeName(typeWriter, dataType) \
|
|
||||||
\
|
|
||||||
defineNamedTemplateTypeNameAndDebug(typeWriter< dataType >, 0)
|
|
||||||
|
|
||||||
// Sometimes used externally
|
|
||||||
#define makeSurfaceWritersTypeName(typeWriter) \
|
|
||||||
\
|
|
||||||
makeTypeSurfaceWritersTypeName(typeWriter, scalar); \
|
|
||||||
makeTypeSurfaceWritersTypeName(typeWriter, vector); \
|
|
||||||
makeTypeSurfaceWritersTypeName(typeWriter, sphericalTensor); \
|
|
||||||
makeTypeSurfaceWritersTypeName(typeWriter, symmTensor); \
|
|
||||||
makeTypeSurfaceWritersTypeName(typeWriter, tensor)
|
|
||||||
|
|
||||||
// Define type info for single dataType template instantiation (eg, vector)
|
|
||||||
#define makeSurfaceWriterType(typeWriter, dataType) \
|
|
||||||
\
|
|
||||||
defineNamedTemplateTypeNameAndDebug(typeWriter< dataType >, 0); \
|
|
||||||
addTemplatedToRunTimeSelectionTable \
|
|
||||||
( \
|
|
||||||
surfaceWriter, typeWriter, dataType, word \
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
// Define type info for scalar, vector etc. instantiations
|
|
||||||
#define makeSurfaceWriters(typeWriter) \
|
|
||||||
\
|
|
||||||
makeSurfaceWriterType(typeWriter, scalar); \
|
|
||||||
makeSurfaceWriterType(typeWriter, vector); \
|
|
||||||
makeSurfaceWriterType(typeWriter, sphericalTensor); \
|
|
||||||
makeSurfaceWriterType(typeWriter, symmTensor); \
|
|
||||||
makeSurfaceWriterType(typeWriter, tensor)
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -28,10 +28,19 @@ License
|
|||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
#include "OSspecific.H"
|
#include "OSspecific.H"
|
||||||
|
|
||||||
|
#include "makeSurfaceWriterMethods.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
makeSurfaceWriterType(vtkSurfaceWriter);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
void Foam::vtkSurfaceWriter::writeGeometry
|
||||||
void Foam::vtkSurfaceWriter<Type>::writeGeometry
|
|
||||||
(
|
(
|
||||||
Ostream& os,
|
Ostream& os,
|
||||||
const pointField& points,
|
const pointField& points,
|
||||||
@ -71,12 +80,12 @@ void Foam::vtkSurfaceWriter<Type>::writeGeometry
|
|||||||
{
|
{
|
||||||
const face& f = faces[faceI];
|
const face& f = faces[faceI];
|
||||||
|
|
||||||
os << f.size();
|
os << f.size();
|
||||||
forAll(f, fp)
|
forAll(f, fp)
|
||||||
{
|
{
|
||||||
os << ' ' << f[fp];
|
os << ' ' << f[fp];
|
||||||
}
|
}
|
||||||
os << nl;
|
os << nl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,15 +93,14 @@ void Foam::vtkSurfaceWriter<Type>::writeGeometry
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Write scalarField in vtk format
|
|
||||||
template<>
|
template<>
|
||||||
void Foam::vtkSurfaceWriter<Foam::scalar>::writeData
|
void Foam::vtkSurfaceWriter::writeData
|
||||||
(
|
(
|
||||||
Ostream& os,
|
Ostream& os,
|
||||||
const Field<Foam::scalar>& values
|
const Field<scalar>& values
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
os << "1 " << values.size() << " float" << nl;
|
os << "1 " << values.size() << " float" << nl;
|
||||||
|
|
||||||
forAll(values, elemI)
|
forAll(values, elemI)
|
||||||
{
|
{
|
||||||
@ -100,29 +108,28 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
if (elemI % 10)
|
if (elemI % 10)
|
||||||
{
|
{
|
||||||
os << ' ';
|
os << ' ';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
os << nl;
|
os << nl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const scalar v = values[elemI];
|
os << float(values[elemI]);
|
||||||
os << float(v);
|
|
||||||
}
|
}
|
||||||
os << nl;
|
os << nl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write vectorField in vtk format
|
|
||||||
template<>
|
template<>
|
||||||
void Foam::vtkSurfaceWriter<Foam::vector>::writeData
|
void Foam::vtkSurfaceWriter::writeData
|
||||||
(
|
(
|
||||||
Ostream& os,
|
Ostream& os,
|
||||||
const Field<Foam::vector>& values
|
const Field<vector>& values
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
os << "3 " << values.size() << " float" << nl;
|
os << "3 " << values.size() << " float" << nl;
|
||||||
|
|
||||||
forAll(values, elemI)
|
forAll(values, elemI)
|
||||||
{
|
{
|
||||||
@ -133,33 +140,31 @@ namespace Foam
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Write sphericalTensorField in vtk format
|
|
||||||
template<>
|
template<>
|
||||||
void Foam::vtkSurfaceWriter<Foam::sphericalTensor>::writeData
|
void Foam::vtkSurfaceWriter::writeData
|
||||||
(
|
(
|
||||||
Ostream& os,
|
Ostream& os,
|
||||||
const Field<sphericalTensor>& values
|
const Field<sphericalTensor>& values
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
os << "1 " << values.size() << " float" << nl;
|
os << "1 " << values.size() << " float" << nl;
|
||||||
|
|
||||||
forAll(values, elemI)
|
forAll(values, elemI)
|
||||||
{
|
{
|
||||||
const sphericalTensor& v = values[elemI];
|
const sphericalTensor& v = values[elemI];
|
||||||
os << float(v[0]) << nl;
|
os << float(v[0]) << nl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Write symmTensorField in vtk format
|
|
||||||
template<>
|
template<>
|
||||||
void Foam::vtkSurfaceWriter<Foam::symmTensor>::writeData
|
void Foam::vtkSurfaceWriter::writeData
|
||||||
(
|
(
|
||||||
Ostream& os,
|
Ostream& os,
|
||||||
const Field<symmTensor>& values
|
const Field<symmTensor>& values
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
os << "6 " << values.size() << " float" << nl;
|
os << "6 " << values.size() << " float" << nl;
|
||||||
|
|
||||||
forAll(values, elemI)
|
forAll(values, elemI)
|
||||||
{
|
{
|
||||||
@ -172,15 +177,14 @@ namespace Foam
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Write tensorField in vtk format
|
|
||||||
template<>
|
template<>
|
||||||
void Foam::vtkSurfaceWriter<Foam::tensor>::writeData
|
void Foam::vtkSurfaceWriter::writeData
|
||||||
(
|
(
|
||||||
Ostream& os,
|
Ostream& os,
|
||||||
const Field<tensor>& values
|
const Field<tensor>& values
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
os << "9 " << values.size() << " float" << nl;
|
os << "9 " << values.size() << " float" << nl;
|
||||||
|
|
||||||
forAll(values, elemI)
|
forAll(values, elemI)
|
||||||
{
|
{
|
||||||
@ -197,69 +201,23 @@ namespace Foam
|
|||||||
|
|
||||||
// Write generic field in vtk format
|
// Write generic field in vtk format
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::vtkSurfaceWriter<Type>::writeData
|
void Foam::vtkSurfaceWriter::writeData
|
||||||
(
|
(
|
||||||
Ostream& os,
|
Ostream& os,
|
||||||
const Field<Type>& values
|
const Field<Type>& values
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
os << "1 " << values.size() << " float" << nl;
|
os << "1 " << values.size() << " float" << nl;
|
||||||
|
|
||||||
forAll(values, elemI)
|
forAll(values, elemI)
|
||||||
{
|
{
|
||||||
os << float(0) << nl;
|
os << float(0) << nl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
// Construct from components
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::vtkSurfaceWriter<Type>::vtkSurfaceWriter()
|
void Foam::vtkSurfaceWriter::writeTemplate
|
||||||
:
|
|
||||||
surfaceWriter<Type>()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Foam::vtkSurfaceWriter<Type>::~vtkSurfaceWriter()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::vtkSurfaceWriter<Type>::write
|
|
||||||
(
|
|
||||||
const fileName& outputDir,
|
|
||||||
const fileName& surfaceName,
|
|
||||||
const pointField& points,
|
|
||||||
const faceList& faces,
|
|
||||||
const bool verbose
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
if (!isDir(outputDir))
|
|
||||||
{
|
|
||||||
mkDir(outputDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
fileName fName(outputDir/surfaceName + ".vtk");
|
|
||||||
|
|
||||||
if (verbose)
|
|
||||||
{
|
|
||||||
Info<< "Writing geometry to " << fName << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
OFstream os(fName);
|
|
||||||
writeGeometry(os, points, faces);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::vtkSurfaceWriter<Type>::write
|
|
||||||
(
|
(
|
||||||
const fileName& outputDir,
|
const fileName& outputDir,
|
||||||
const fileName& surfaceName,
|
const fileName& surfaceName,
|
||||||
@ -276,10 +234,7 @@ void Foam::vtkSurfaceWriter<Type>::write
|
|||||||
mkDir(outputDir);
|
mkDir(outputDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
OFstream os
|
OFstream os(outputDir/fieldName + '_' + surfaceName + ".vtk");
|
||||||
(
|
|
||||||
outputDir/fieldName + '_' + surfaceName + ".vtk"
|
|
||||||
);
|
|
||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
{
|
{
|
||||||
@ -304,8 +259,52 @@ void Foam::vtkSurfaceWriter<Type>::write
|
|||||||
|
|
||||||
// Write data
|
// Write data
|
||||||
writeData(os, values);
|
writeData(os, values);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::vtkSurfaceWriter::vtkSurfaceWriter()
|
||||||
|
:
|
||||||
|
surfaceWriter()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::vtkSurfaceWriter::~vtkSurfaceWriter()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::vtkSurfaceWriter::write
|
||||||
|
(
|
||||||
|
const fileName& outputDir,
|
||||||
|
const fileName& surfaceName,
|
||||||
|
const pointField& points,
|
||||||
|
const faceList& faces,
|
||||||
|
const bool verbose
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (!isDir(outputDir))
|
||||||
|
{
|
||||||
|
mkDir(outputDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
OFstream os(outputDir/surfaceName + ".vtk");
|
||||||
|
|
||||||
|
if (verbose)
|
||||||
|
{
|
||||||
|
Info<< "Writing geometry to " << os.name() << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
writeGeometry(os, points, faces);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// create write methods
|
||||||
|
defineSurfaceWriterWriteFields(Foam::vtkSurfaceWriter);
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -25,6 +25,7 @@ Class
|
|||||||
Foam::vtkSurfaceWriter
|
Foam::vtkSurfaceWriter
|
||||||
|
|
||||||
Description
|
Description
|
||||||
|
A surfaceWriter for VTK legacy format.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
vtkSurfaceWriter.C
|
vtkSurfaceWriter.C
|
||||||
@ -42,21 +43,35 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class vtkSurfaceWriter Declaration
|
Class vtkSurfaceWriter Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
class vtkSurfaceWriter
|
class vtkSurfaceWriter
|
||||||
:
|
:
|
||||||
public surfaceWriter<Type>
|
public surfaceWriter
|
||||||
{
|
{
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
static void writeGeometry(Ostream&, const pointField&, const faceList&);
|
static void writeGeometry(Ostream&, const pointField&, const faceList&);
|
||||||
|
|
||||||
static void writeData(Ostream&, const Field<Type>& values);
|
template<class Type>
|
||||||
|
static void writeData(Ostream&, const Field<Type>&);
|
||||||
|
|
||||||
|
|
||||||
|
//- Templated write operation
|
||||||
|
template<class Type>
|
||||||
|
void writeTemplate
|
||||||
|
(
|
||||||
|
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;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
@ -75,9 +90,7 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
// Write
|
//- Write single surface geometry to file.
|
||||||
|
|
||||||
//- Write geometry to file.
|
|
||||||
virtual void write
|
virtual void write
|
||||||
(
|
(
|
||||||
const fileName& outputDir,
|
const fileName& outputDir,
|
||||||
@ -88,18 +101,76 @@ public:
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|
||||||
//- Writes single surface to file.
|
//- Write scalarField for a single surface to file.
|
||||||
|
// One value per face or vertex (isNodeValues = true)
|
||||||
virtual void write
|
virtual void write
|
||||||
(
|
(
|
||||||
const fileName& outputDir,
|
const fileName& outputDir, // <root>/<case>/surface/TIME
|
||||||
const fileName& surfaceName,
|
const fileName& surfaceName, // name of surface
|
||||||
const pointField& points,
|
const pointField& points,
|
||||||
const faceList& faces,
|
const faceList& faces,
|
||||||
const word& fieldName,
|
const word& fieldName, // name of field
|
||||||
const Field<Type>& values,
|
const Field<scalar>& values,
|
||||||
const bool isNodeValues,
|
const bool isNodeValues,
|
||||||
const bool verbose = false
|
const bool verbose = false
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
//- Write vectorField for a single surface to file.
|
||||||
|
// One value per face or vertex (isNodeValues = true)
|
||||||
|
virtual void write
|
||||||
|
(
|
||||||
|
const fileName& outputDir, // <root>/<case>/surface/TIME
|
||||||
|
const fileName& surfaceName, // name of surface
|
||||||
|
const pointField& points,
|
||||||
|
const faceList& faces,
|
||||||
|
const word& fieldName, // name of field
|
||||||
|
const Field<vector>& values,
|
||||||
|
const bool isNodeValues,
|
||||||
|
const bool verbose = false
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Write sphericalTensorField for a single surface to file.
|
||||||
|
// One value per face or vertex (isNodeValues = true)
|
||||||
|
virtual void write
|
||||||
|
(
|
||||||
|
const fileName& outputDir, // <root>/<case>/surface/TIME
|
||||||
|
const fileName& surfaceName, // name of surface
|
||||||
|
const pointField& points,
|
||||||
|
const faceList& faces,
|
||||||
|
const word& fieldName, // name of field
|
||||||
|
const Field<sphericalTensor>& values,
|
||||||
|
const bool isNodeValues,
|
||||||
|
const bool verbose = false
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Write symmTensorField for a single surface to file.
|
||||||
|
// One value per face or vertex (isNodeValues = true)
|
||||||
|
virtual void write
|
||||||
|
(
|
||||||
|
const fileName& outputDir, // <root>/<case>/surface/TIME
|
||||||
|
const fileName& surfaceName, // name of surface
|
||||||
|
const pointField& points,
|
||||||
|
const faceList& faces,
|
||||||
|
const word& fieldName, // name of field
|
||||||
|
const Field<symmTensor>& values,
|
||||||
|
const bool isNodeValues,
|
||||||
|
const bool verbose = false
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Write tensorField for a single surface to file.
|
||||||
|
// One value per face or vertex (isNodeValues = true)
|
||||||
|
virtual void write
|
||||||
|
(
|
||||||
|
const fileName& outputDir, // <root>/<case>/surface/TIME
|
||||||
|
const fileName& surfaceName, // name of surface
|
||||||
|
const pointField& points,
|
||||||
|
const faceList& faces,
|
||||||
|
const word& fieldName, // name of field
|
||||||
|
const Field<tensor>& values,
|
||||||
|
const bool isNodeValues,
|
||||||
|
const bool verbose = false
|
||||||
|
) const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -109,12 +180,6 @@ public:
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#ifdef NoRepository
|
|
||||||
# include "vtkSurfaceWriter.C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -1,44 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2004-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 "vtkSurfaceWriter.H"
|
|
||||||
#include "surfaceWriters.H"
|
|
||||||
#include "addToRunTimeSelectionTable.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
makeSurfaceWriterType(vtkSurfaceWriter, bool);
|
|
||||||
makeSurfaceWriters(vtkSurfaceWriter);
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
Reference in New Issue
Block a user