mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: add IOobject-based constructors for meshed surfaces (#1600)
- refactor logic from triSurfaceMesh for triSurface, MeshedSurface, UnsortedMeshedSurface. Makes it easier to locate and use surface files without the triSurfaceMesh (meshTools) infrastructure. STYLE: remove unused sampledTriSurfaceMesh constructors
This commit is contained in:
@ -47,97 +47,6 @@ Foam::word Foam::triSurfaceMesh::meshSubDir = "triSurface";
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
Foam::fileName Foam::triSurfaceMesh::checkFile
|
||||
(
|
||||
const IOobject& io,
|
||||
const bool isGlobal
|
||||
)
|
||||
{
|
||||
const fileName fName
|
||||
(
|
||||
isGlobal
|
||||
? io.globalFilePath(typeName)
|
||||
: io.localFilePath(typeName)
|
||||
);
|
||||
if (fName.empty())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot find triSurfaceMesh starting from "
|
||||
<< io.objectPath() << exit(FatalError);
|
||||
}
|
||||
|
||||
return fName;
|
||||
}
|
||||
|
||||
|
||||
Foam::fileName Foam::triSurfaceMesh::relativeFilePath
|
||||
(
|
||||
const IOobject& io,
|
||||
const fileName& f,
|
||||
const bool isGlobal
|
||||
)
|
||||
{
|
||||
fileName fName(f);
|
||||
fName.expand();
|
||||
if (!fName.isAbsolute())
|
||||
{
|
||||
// Is the specified file:
|
||||
// - local to the cwd?
|
||||
// - local to the case dir?
|
||||
// - or just another name?
|
||||
fName = fileHandler().filePath
|
||||
(
|
||||
isGlobal,
|
||||
IOobject(io, fName),
|
||||
word::null
|
||||
);
|
||||
}
|
||||
return fName;
|
||||
}
|
||||
|
||||
Foam::fileName Foam::triSurfaceMesh::checkFile
|
||||
(
|
||||
const IOobject& io,
|
||||
const dictionary& dict,
|
||||
const bool isGlobal
|
||||
)
|
||||
{
|
||||
fileName fName;
|
||||
if (dict.readIfPresent("file", fName, keyType::LITERAL))
|
||||
{
|
||||
const fileName rawFName(fName);
|
||||
|
||||
fName = relativeFilePath(io, rawFName, isGlobal);
|
||||
|
||||
if (!exists(fName))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot find triSurfaceMesh " << rawFName
|
||||
<< " starting from " << io.objectPath()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fName =
|
||||
(
|
||||
isGlobal
|
||||
? io.globalFilePath(typeName)
|
||||
: io.localFilePath(typeName)
|
||||
);
|
||||
|
||||
if (!exists(fName))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot find triSurfaceMesh starting from "
|
||||
<< io.objectPath() << exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
return fName;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::triSurfaceMesh::addFaceToEdge
|
||||
(
|
||||
const edge& e,
|
||||
@ -308,7 +217,7 @@ Foam::triSurfaceMesh::triSurfaceMesh(const IOobject& io)
|
||||
false // searchableSurface already registered under name
|
||||
)
|
||||
),
|
||||
triSurface(checkFile(static_cast<const searchableSurface&>(*this), true)),
|
||||
triSurface(static_cast<const searchableSurface&>(*this), dictionary::null),
|
||||
triSurfaceRegionSearch(static_cast<const triSurface&>(*this)),
|
||||
minQuality_(-1),
|
||||
surfaceClosed_(-1),
|
||||
@ -341,19 +250,16 @@ Foam::triSurfaceMesh::triSurfaceMesh
|
||||
false // searchableSurface already registered under name
|
||||
)
|
||||
),
|
||||
triSurface
|
||||
(
|
||||
checkFile(static_cast<const searchableSurface&>(*this), dict, true)
|
||||
),
|
||||
triSurface(static_cast<const searchableSurface&>(*this), dict),
|
||||
triSurfaceRegionSearch(static_cast<const triSurface&>(*this), dict),
|
||||
minQuality_(-1),
|
||||
surfaceClosed_(-1),
|
||||
outsideVolType_(volumeType::UNKNOWN)
|
||||
{
|
||||
// Reading from supplied file name instead of objectPath/filePath
|
||||
// Adjust to use supplied file name instead of objectPath/filePath
|
||||
if (dict.readIfPresent("file", fName_, keyType::LITERAL))
|
||||
{
|
||||
fName_ = relativeFilePath
|
||||
fName_ = triSurface::relativeFilePath
|
||||
(
|
||||
static_cast<const searchableSurface&>(*this),
|
||||
fName_,
|
||||
@ -404,7 +310,7 @@ Foam::triSurfaceMesh::triSurfaceMesh(const IOobject& io, const readAction r)
|
||||
false // searchableSurface already registered under name
|
||||
)
|
||||
),
|
||||
triSurface(), // construct null
|
||||
triSurface(),
|
||||
triSurfaceRegionSearch(static_cast<const triSurface&>(*this)),
|
||||
minQuality_(-1),
|
||||
surfaceClosed_(-1),
|
||||
@ -502,7 +408,7 @@ Foam::triSurfaceMesh::triSurfaceMesh
|
||||
false // searchableSurface already registered under name
|
||||
)
|
||||
),
|
||||
triSurface(), // construct null
|
||||
triSurface(),
|
||||
triSurfaceRegionSearch(static_cast<const triSurface&>(*this), dict),
|
||||
minQuality_(-1),
|
||||
surfaceClosed_(-1),
|
||||
|
||||
@ -106,26 +106,6 @@ protected:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Return fileName to load IOobject from
|
||||
static fileName checkFile(const IOobject& io, const bool isGlobal);
|
||||
|
||||
//- Return fileName. If fileName is relative gets treated local to
|
||||
// IOobject
|
||||
static fileName relativeFilePath
|
||||
(
|
||||
const IOobject&,
|
||||
const fileName&,
|
||||
const bool isGlobal
|
||||
);
|
||||
|
||||
//- Return fileName to load IOobject from. Optional override of fileName
|
||||
static fileName checkFile
|
||||
(
|
||||
const IOobject&,
|
||||
const dictionary&,
|
||||
const bool isGlobal
|
||||
);
|
||||
|
||||
//- Helper function for isSurfaceClosed
|
||||
static bool addFaceToEdge
|
||||
(
|
||||
|
||||
@ -2557,7 +2557,7 @@ Foam::distributedTriSurfaceMesh::distributedTriSurfaceMesh(const IOobject& io)
|
||||
|
||||
bounds().reduce();
|
||||
|
||||
const fileName actualFile(checkFile(io, true));
|
||||
const fileName actualFile(triSurfaceMesh::checkFile(io, true));
|
||||
|
||||
if
|
||||
(
|
||||
@ -2697,7 +2697,7 @@ Foam::distributedTriSurfaceMesh::distributedTriSurfaceMesh
|
||||
|
||||
bounds().reduce();
|
||||
|
||||
const fileName actualFile(checkFile(io, dict, true));
|
||||
const fileName actualFile(triSurfaceMesh::checkFile(io, dict, true));
|
||||
|
||||
if
|
||||
(
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -121,32 +122,34 @@ Foam::triSurfaceMeshPointSet::triSurfaceMeshPointSet
|
||||
)
|
||||
:
|
||||
sampledSet(name, mesh, searchEngine, dict),
|
||||
surface_(dict.get<word>("surface"))
|
||||
surfaceName_(dict.get<word>("surface"))
|
||||
{
|
||||
// Load surface.
|
||||
if (mesh.time().foundObject<triSurfaceMesh>(surface_))
|
||||
// Get or load surface
|
||||
|
||||
const auto* surfPtr =
|
||||
mesh.time().cfindObject<triSurfaceMesh>(surfaceName_);
|
||||
|
||||
if (surfPtr)
|
||||
{
|
||||
// Note: should use localPoints() instead of points() but assume
|
||||
// trisurface is compact.
|
||||
sampleCoords_ = mesh.time().lookupObject<triSurfaceMesh>
|
||||
(
|
||||
surface_
|
||||
).points();
|
||||
sampleCoords_ = surfPtr->points();
|
||||
}
|
||||
else
|
||||
{
|
||||
sampleCoords_ = triSurfaceMesh
|
||||
sampleCoords_ = triSurface
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
surface_,
|
||||
surfaceName_,
|
||||
mesh.time().constant(), // instance
|
||||
"triSurface", // local
|
||||
mesh.time(),
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
),
|
||||
dictionary::null
|
||||
).points();
|
||||
}
|
||||
|
||||
|
||||
@ -60,10 +60,10 @@ class triSurfaceMeshPointSet
|
||||
:
|
||||
public sampledSet
|
||||
{
|
||||
// Private data
|
||||
// Private Data
|
||||
|
||||
//- Name of triSurfaceMesh
|
||||
const word surface_;
|
||||
//- The surface name
|
||||
const word surfaceName_;
|
||||
|
||||
//- Sampling points
|
||||
List<point> sampleCoords_;
|
||||
|
||||
@ -33,7 +33,6 @@ License
|
||||
#include "treeDataCell.H"
|
||||
#include "treeDataFace.H"
|
||||
#include "meshTools.H"
|
||||
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
@ -78,8 +77,32 @@ namespace Foam
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// The IOobject for reading
|
||||
inline static IOobject selectReadIO(const word& name, const Time& runTime)
|
||||
{
|
||||
return IOobject
|
||||
(
|
||||
name,
|
||||
runTime.constant(), // instance
|
||||
"triSurface", // local
|
||||
runTime, // registry
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false // no register
|
||||
);
|
||||
}
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
@ -94,14 +117,14 @@ void Foam::sampledTriSurfaceMesh::setZoneMap
|
||||
{
|
||||
sz += zn.size();
|
||||
}
|
||||
zoneIds.resize(sz);
|
||||
|
||||
zoneIds.setSize(sz);
|
||||
forAll(zoneLst, zonei)
|
||||
{
|
||||
const surfZone& zn = zoneLst[zonei];
|
||||
|
||||
// Assign sub-zone Ids
|
||||
SubList<label>(zoneIds, zn.size(), zn.start()) = zonei;
|
||||
SubList<label>(zoneIds, zn.range()) = zonei;
|
||||
}
|
||||
}
|
||||
|
||||
@ -224,8 +247,8 @@ bool Foam::sampledTriSurfaceMesh::update(const meshSearch& meshSearcher)
|
||||
<< " keeping:" << nFound << endl;
|
||||
}
|
||||
|
||||
// Now subset the surface. Do not use triSurface::subsetMesh since requires
|
||||
// original surface to be in compact numbering.
|
||||
// Now subset the surface.
|
||||
// Done manually in case the original had non-compact point numbering
|
||||
|
||||
const triSurface& s = surface_;
|
||||
|
||||
@ -393,15 +416,10 @@ bool Foam::sampledTriSurfaceMesh::update(const meshSearch& meshSearcher)
|
||||
|
||||
forAll(faceMap, facei)
|
||||
{
|
||||
const labelledTri& origF = s[faceMap[facei]];
|
||||
face& f = surfFaces[facei];
|
||||
|
||||
f = triFace
|
||||
(
|
||||
reversePointMap[origF[0]],
|
||||
reversePointMap[origF[1]],
|
||||
reversePointMap[origF[2]]
|
||||
);
|
||||
f = s[faceMap[facei]]; // Copy original face
|
||||
inplaceRenumber(reversePointMap, f); // renumber point ids
|
||||
|
||||
for (const label labi : f)
|
||||
{
|
||||
@ -583,18 +601,11 @@ Foam::sampledTriSurfaceMesh::sampledTriSurfaceMesh
|
||||
:
|
||||
sampledSurface(name, mesh),
|
||||
MeshStorage(),
|
||||
surfaceName_(surfaceName),
|
||||
surface_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
surfaceName,
|
||||
mesh.time().constant(), // instance
|
||||
"triSurface", // local
|
||||
mesh.time(), // registry
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
selectReadIO(surfaceName, mesh.time()),
|
||||
dictionary::null
|
||||
),
|
||||
sampleSource_(sampleSource),
|
||||
needsUpdate_(true),
|
||||
@ -615,18 +626,17 @@ Foam::sampledTriSurfaceMesh::sampledTriSurfaceMesh
|
||||
:
|
||||
sampledSurface(name, mesh, dict),
|
||||
MeshStorage(),
|
||||
surfaceName_
|
||||
(
|
||||
triSurface::findFile
|
||||
(
|
||||
selectReadIO(dict.get<word>("surface"), mesh.time()),
|
||||
dict
|
||||
).name()
|
||||
),
|
||||
surface_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
dict.get<word>("surface"),
|
||||
mesh.time().constant(), // instance
|
||||
"triSurface", // local
|
||||
mesh.time(), // registry
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
selectReadIO(dict.get<word>("surface"), mesh.time()),
|
||||
dict
|
||||
),
|
||||
sampleSource_(samplingSourceNames_.get("source", dict)),
|
||||
@ -639,46 +649,6 @@ Foam::sampledTriSurfaceMesh::sampledTriSurfaceMesh
|
||||
{}
|
||||
|
||||
|
||||
Foam::sampledTriSurfaceMesh::sampledTriSurfaceMesh
|
||||
(
|
||||
const word& name,
|
||||
const polyMesh& mesh,
|
||||
const triSurface& surface,
|
||||
const word& sampleSourceName
|
||||
)
|
||||
:
|
||||
sampledSurface(name, mesh),
|
||||
MeshStorage(),
|
||||
surface_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
name,
|
||||
mesh.time().constant(), // instance
|
||||
"triSurface", // local
|
||||
mesh.time(), // registry
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
surface
|
||||
),
|
||||
sampleSource_(samplingSourceNames_[sampleSourceName]),
|
||||
needsUpdate_(true),
|
||||
keepIds_(false),
|
||||
originalIds_(),
|
||||
zoneIds_(),
|
||||
sampleElements_(),
|
||||
samplePoints_()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::sampledTriSurfaceMesh::~sampledTriSurfaceMesh()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::sampledTriSurfaceMesh::needsUpdate() const
|
||||
@ -700,7 +670,6 @@ bool Foam::sampledTriSurfaceMesh::expire()
|
||||
zoneIds_.clear();
|
||||
|
||||
originalIds_.clear();
|
||||
boundaryTreePtr_.clear();
|
||||
sampleElements_.clear();
|
||||
samplePoints_.clear();
|
||||
|
||||
@ -717,11 +686,7 @@ bool Foam::sampledTriSurfaceMesh::update()
|
||||
}
|
||||
|
||||
// Calculate surface and mesh overlap bounding box
|
||||
treeBoundBox bb
|
||||
(
|
||||
surface_.triSurface::points(),
|
||||
surface_.triSurface::meshPoints()
|
||||
);
|
||||
treeBoundBox bb(surface_.points(), surface_.meshPoints());
|
||||
|
||||
// Check for overlap with (global!) mesh bb
|
||||
const bool intersect = bb.intersect(mesh().bounds());
|
||||
@ -732,7 +697,7 @@ bool Foam::sampledTriSurfaceMesh::update()
|
||||
// bounding box so we don't get any 'invalid bounding box' errors.
|
||||
|
||||
WarningInFunction
|
||||
<< "Surface " << surface_.searchableSurface::name()
|
||||
<< "Surface " << surfaceName_
|
||||
<< " does not overlap bounding box of mesh " << mesh().bounds()
|
||||
<< endl;
|
||||
|
||||
@ -865,7 +830,7 @@ Foam::tmp<Foam::tensorField> Foam::sampledTriSurfaceMesh::interpolate
|
||||
void Foam::sampledTriSurfaceMesh::print(Ostream& os) const
|
||||
{
|
||||
os << "sampledTriSurfaceMesh: " << name() << " :"
|
||||
<< " surface:" << surface_.objectRegistry::name()
|
||||
<< " surface:" << surfaceName_
|
||||
<< " faces:" << faces().size()
|
||||
<< " points:" << points().size()
|
||||
<< " zoneids:" << zoneIds().size();
|
||||
|
||||
@ -28,8 +28,8 @@ Class
|
||||
Foam::sampledTriSurfaceMesh
|
||||
|
||||
Description
|
||||
A sampledSurface from a triSurfaceMesh. It samples on the points/triangles
|
||||
of the triSurface.
|
||||
A sampledSurface from a meshed surface.
|
||||
It samples on the points/faces of the triSurface.
|
||||
|
||||
- it either samples cells or (non-coupled) boundary faces
|
||||
|
||||
@ -98,7 +98,7 @@ SourceFiles
|
||||
#define sampledTriSurfaceMesh_H
|
||||
|
||||
#include "sampledSurface.H"
|
||||
#include "triSurfaceMesh.H"
|
||||
#include "triSurface.H"
|
||||
#include "MeshedSurface.H"
|
||||
#include "MeshedSurfacesFwd.H"
|
||||
|
||||
@ -120,7 +120,7 @@ class sampledTriSurfaceMesh
|
||||
public meshedSurface
|
||||
{
|
||||
public:
|
||||
//- Types of communications
|
||||
//- Types of sampling regions
|
||||
enum samplingSource
|
||||
{
|
||||
cells,
|
||||
@ -130,7 +130,7 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
//- Private typedefs for convenience
|
||||
//- Private typedefs for convenience
|
||||
typedef meshedSurface MeshStorage;
|
||||
|
||||
|
||||
@ -138,8 +138,11 @@ private:
|
||||
|
||||
static const Enum<samplingSource> samplingSourceNames_;
|
||||
|
||||
//- The name of the input surface
|
||||
word surfaceName_;
|
||||
|
||||
//- Surface to sample on
|
||||
const triSurfaceMesh surface_;
|
||||
const triSurface surface_;
|
||||
|
||||
//- Whether to sample internal cell values or boundary values
|
||||
const samplingSource sampleSource_;
|
||||
@ -151,12 +154,9 @@ private:
|
||||
bool keepIds_;
|
||||
|
||||
//- List of element ids/order of the original surface,
|
||||
// when keepIds is active.
|
||||
//- when keepIds is active.
|
||||
labelList originalIds_;
|
||||
|
||||
//- Search tree for all non-coupled boundary faces
|
||||
mutable autoPtr<indexedOctree<treeDataFace>> boundaryTreePtr_;
|
||||
|
||||
//- For compatibility with the meshSurf interface
|
||||
labelList zoneIds_;
|
||||
|
||||
@ -210,18 +210,9 @@ public:
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
//- Construct from triSurface
|
||||
sampledTriSurfaceMesh
|
||||
(
|
||||
const word& name,
|
||||
const polyMesh& mesh,
|
||||
const triSurface& surface,
|
||||
const word& sampleSourceName
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~sampledTriSurfaceMesh();
|
||||
virtual ~sampledTriSurfaceMesh() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2018 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -67,18 +67,6 @@ Foam::sampledTriSurfaceMeshNormal::sampledTriSurfaceMeshNormal
|
||||
{}
|
||||
|
||||
|
||||
Foam::sampledTriSurfaceMeshNormal::sampledTriSurfaceMeshNormal
|
||||
(
|
||||
const word& name,
|
||||
const polyMesh& mesh,
|
||||
const triSurface& surface,
|
||||
const word& sampleSourceName
|
||||
)
|
||||
:
|
||||
sampledTriSurfaceMesh(name, mesh, surface, sampleSourceName)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::tmp<Foam::Field<Foam::vector>>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2018 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -110,15 +110,6 @@ public:
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
//- Construct from triSurface
|
||||
sampledTriSurfaceMeshNormal
|
||||
(
|
||||
const word& name,
|
||||
const polyMesh& mesh,
|
||||
const triSurface& surface,
|
||||
const word& sampleSourceName
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~sampledTriSurfaceMeshNormal() = default;
|
||||
|
||||
@ -393,7 +393,11 @@ Foam::MeshedSurface<Face>::MeshedSurface
|
||||
|
||||
|
||||
template<class Face>
|
||||
Foam::MeshedSurface<Face>::MeshedSurface(const fileName& name, const word& ext)
|
||||
Foam::MeshedSurface<Face>::MeshedSurface
|
||||
(
|
||||
const fileName& name,
|
||||
const word& ext
|
||||
)
|
||||
:
|
||||
MeshedSurface<Face>()
|
||||
{
|
||||
@ -419,6 +423,16 @@ Foam::MeshedSurface<Face>::MeshedSurface(Istream& is)
|
||||
}
|
||||
|
||||
|
||||
template<class Face>
|
||||
Foam::MeshedSurface<Face>::MeshedSurface
|
||||
(
|
||||
const Time& runTime
|
||||
)
|
||||
:
|
||||
MeshedSurface<Face>(runTime, word::null)
|
||||
{}
|
||||
|
||||
|
||||
template<class Face>
|
||||
Foam::MeshedSurface<Face>::MeshedSurface
|
||||
(
|
||||
@ -452,6 +466,31 @@ Foam::MeshedSurface<Face>::MeshedSurface
|
||||
}
|
||||
|
||||
|
||||
template<class Face>
|
||||
Foam::MeshedSurface<Face>::MeshedSurface
|
||||
(
|
||||
const IOobject& io,
|
||||
const dictionary& dict,
|
||||
const bool isGlobal
|
||||
)
|
||||
:
|
||||
MeshedSurface<Face>()
|
||||
{
|
||||
fileName fName
|
||||
(
|
||||
fileFormats::surfaceFormatsCore::checkFile(io, dict, isGlobal)
|
||||
);
|
||||
|
||||
// TBD:
|
||||
// word fExt(dict.getOrDefault<word>("surfaceType", fName.ext()));
|
||||
// read(fName, fExt);
|
||||
|
||||
this->read(fName, fName.ext());
|
||||
|
||||
this->scalePoints(dict.getOrDefault<scalar>("scale", 0));
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Face>
|
||||
|
||||
@ -270,19 +270,32 @@ public:
|
||||
);
|
||||
|
||||
//- Construct from a surfMesh
|
||||
MeshedSurface(const surfMesh& mesh);
|
||||
explicit MeshedSurface(const surfMesh& mesh);
|
||||
|
||||
//- Construct from file name (uses extension to determine type)
|
||||
MeshedSurface(const fileName& name);
|
||||
explicit MeshedSurface(const fileName& name);
|
||||
|
||||
//- Construct from file name (uses extension to determine type)
|
||||
MeshedSurface(const fileName& name, const word& ext);
|
||||
explicit MeshedSurface(const fileName& name, const word& ext);
|
||||
|
||||
//- Construct from Istream
|
||||
MeshedSurface(Istream& is);
|
||||
explicit MeshedSurface(Istream& is);
|
||||
|
||||
//- Construct from database
|
||||
MeshedSurface(const Time& runTime, const word& surfName = word::null);
|
||||
//- Construct from database (as surfMesh) with default name
|
||||
explicit MeshedSurface(const Time& runTime);
|
||||
|
||||
//- Construct from database (as surfMesh) with given surface name
|
||||
MeshedSurface(const Time& runTime, const word& surfName);
|
||||
|
||||
//- Read construct using IO to find the file location.
|
||||
// Dictionary may contain optional 'file' entry, and an
|
||||
// optional 'scale' entry (eg, 0.001: mm -> m)
|
||||
MeshedSurface
|
||||
(
|
||||
const IOobject& io,
|
||||
const dictionary& dict,
|
||||
const bool isGlobal = true //!< resolve as a global file
|
||||
);
|
||||
|
||||
|
||||
// Declare run-time constructor selection table
|
||||
|
||||
@ -270,17 +270,55 @@ Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface
|
||||
template<class Face>
|
||||
Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface
|
||||
(
|
||||
const Time& t,
|
||||
const Time& runTime
|
||||
)
|
||||
:
|
||||
UnsortedMeshedSurface<Face>()
|
||||
{
|
||||
MeshedSurface<Face> surf(runTime);
|
||||
transfer(surf);
|
||||
}
|
||||
|
||||
|
||||
template<class Face>
|
||||
Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface
|
||||
(
|
||||
const Time& runTime,
|
||||
const word& surfName
|
||||
)
|
||||
:
|
||||
UnsortedMeshedSurface<Face>()
|
||||
{
|
||||
MeshedSurface<Face> surf(t, surfName);
|
||||
MeshedSurface<Face> surf(runTime, surfName);
|
||||
transfer(surf);
|
||||
}
|
||||
|
||||
|
||||
template<class Face>
|
||||
Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface
|
||||
(
|
||||
const IOobject& io,
|
||||
const dictionary& dict,
|
||||
const bool isGlobal
|
||||
)
|
||||
:
|
||||
UnsortedMeshedSurface<Face>()
|
||||
{
|
||||
fileName fName
|
||||
(
|
||||
fileFormats::surfaceFormatsCore::checkFile(io, dict, isGlobal)
|
||||
);
|
||||
|
||||
// TBD:
|
||||
// word fExt(dict.getOrDefault<word>("surfaceType", fName.ext()));
|
||||
// read(fName, fExt);
|
||||
|
||||
this->read(fName, fName.ext());
|
||||
|
||||
this->scalePoints(dict.getOrDefault<scalar>("scale", 0));
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class Face>
|
||||
@ -291,19 +329,15 @@ void Foam::UnsortedMeshedSurface<Face>::setOneZone()
|
||||
zoneIds_.resize(size());
|
||||
zoneIds_ = 0;
|
||||
|
||||
word zoneName;
|
||||
if (zoneToc_.size())
|
||||
{
|
||||
zoneName = zoneToc_[0].name();
|
||||
}
|
||||
if (zoneName.empty())
|
||||
{
|
||||
zoneName = "zone0";
|
||||
}
|
||||
|
||||
// Assign single default zone
|
||||
zoneToc_.resize(1);
|
||||
zoneToc_[0] = surfZoneIdentifier(zoneName, 0);
|
||||
|
||||
zoneToc_[0].index() = 0;
|
||||
|
||||
if (zoneToc_[0].name().empty())
|
||||
{
|
||||
zoneToc_[0].name() = "zone0";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -324,7 +358,7 @@ void Foam::UnsortedMeshedSurface<Face>::setZones
|
||||
zoneToc_[zonei] = zone;
|
||||
|
||||
// Assign sub-zone Ids
|
||||
SubList<label>(zoneIds_, zone.size(), zone.start()) = zonei;
|
||||
SubList<label>(zoneIds_, zone.range()) = zonei;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -203,19 +203,28 @@ public:
|
||||
);
|
||||
|
||||
//- Construct from file name (uses extension to determine type)
|
||||
UnsortedMeshedSurface(const fileName& name);
|
||||
explicit UnsortedMeshedSurface(const fileName& name);
|
||||
|
||||
//- Construct from file name (uses extension to determine type)
|
||||
UnsortedMeshedSurface(const fileName& name, const word& ext);
|
||||
|
||||
//- Construct from Istream
|
||||
UnsortedMeshedSurface(Istream& is);
|
||||
explicit UnsortedMeshedSurface(Istream& is);
|
||||
|
||||
//- Construct from objectRegistry and a named surface
|
||||
//- Construct from database (as surfMesh) with default name
|
||||
explicit UnsortedMeshedSurface(const Time& runTime);
|
||||
|
||||
//- Construct from database (as surfMesh) with given surface name
|
||||
UnsortedMeshedSurface(const Time& runTime, const word& surfName);
|
||||
|
||||
//- Read construct using IO to find the file location.
|
||||
// Dictionary may contain optional 'file' entry, and an
|
||||
// optional 'scale' entry (eg, 0.001: mm -> m)
|
||||
UnsortedMeshedSurface
|
||||
(
|
||||
const Time& t,
|
||||
const word& surfName = word::null
|
||||
const IOobject& io,
|
||||
const dictionary& dict,
|
||||
const bool isGlobal = true //!< resolve as a global file
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
Copyright (C) 2017 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -27,7 +27,6 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "surfaceFormatsCore.H"
|
||||
|
||||
#include "Time.H"
|
||||
#include "ListOps.H"
|
||||
#include "Fstream.H"
|
||||
@ -157,6 +156,154 @@ Foam::fileName Foam::fileFormats::surfaceFormatsCore::findMeshFile
|
||||
#endif
|
||||
|
||||
|
||||
Foam::fileName Foam::fileFormats::surfaceFormatsCore::relativeFilePath
|
||||
(
|
||||
const IOobject& io,
|
||||
const fileName& f,
|
||||
const bool isGlobal
|
||||
)
|
||||
{
|
||||
fileName fName(f);
|
||||
fName.expand();
|
||||
if (!fName.isAbsolute())
|
||||
{
|
||||
// Is the specified file:
|
||||
// - local to the cwd?
|
||||
// - local to the case dir?
|
||||
// - or just another name?
|
||||
fName = fileHandler().filePath
|
||||
(
|
||||
isGlobal,
|
||||
IOobject(io, fName),
|
||||
word::null
|
||||
);
|
||||
}
|
||||
return fName;
|
||||
}
|
||||
|
||||
|
||||
Foam::fileName Foam::fileFormats::surfaceFormatsCore::findFile
|
||||
(
|
||||
const IOobject& io,
|
||||
const bool isGlobal
|
||||
)
|
||||
{
|
||||
fileName fName
|
||||
(
|
||||
isGlobal
|
||||
? io.globalFilePath(word::null)
|
||||
: io.localFilePath(word::null)
|
||||
);
|
||||
|
||||
if (!exists(fName))
|
||||
{
|
||||
fName.clear();
|
||||
}
|
||||
|
||||
return fName;
|
||||
}
|
||||
|
||||
|
||||
Foam::fileName Foam::fileFormats::surfaceFormatsCore::findFile
|
||||
(
|
||||
const IOobject& io,
|
||||
const dictionary& dict,
|
||||
const bool isGlobal
|
||||
)
|
||||
{
|
||||
fileName fName;
|
||||
if (dict.readIfPresent("file", fName, keyType::LITERAL))
|
||||
{
|
||||
fName = relativeFilePath(io, fName, isGlobal);
|
||||
}
|
||||
else
|
||||
{
|
||||
fName =
|
||||
(
|
||||
isGlobal
|
||||
? io.globalFilePath(word::null)
|
||||
: io.localFilePath(word::null)
|
||||
);
|
||||
}
|
||||
|
||||
if (!exists(fName))
|
||||
{
|
||||
fName.clear();
|
||||
}
|
||||
|
||||
return fName;
|
||||
}
|
||||
|
||||
|
||||
Foam::fileName Foam::fileFormats::surfaceFormatsCore::checkFile
|
||||
(
|
||||
const IOobject& io,
|
||||
const bool isGlobal
|
||||
)
|
||||
{
|
||||
fileName fName
|
||||
(
|
||||
isGlobal
|
||||
? io.globalFilePath(word::null)
|
||||
: io.localFilePath(word::null)
|
||||
);
|
||||
|
||||
if (fName.empty())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot find surface starting from "
|
||||
<< io.objectPath() << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return fName;
|
||||
}
|
||||
|
||||
|
||||
Foam::fileName Foam::fileFormats::surfaceFormatsCore::checkFile
|
||||
(
|
||||
const IOobject& io,
|
||||
const dictionary& dict,
|
||||
const bool isGlobal
|
||||
)
|
||||
{
|
||||
fileName fName;
|
||||
if (dict.readIfPresent("file", fName, keyType::LITERAL))
|
||||
{
|
||||
const fileName rawFName(fName);
|
||||
|
||||
fName = relativeFilePath(io, rawFName, isGlobal);
|
||||
|
||||
if (!exists(fName))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot find surface " << rawFName
|
||||
<< " starting from " << io.objectPath() << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fName =
|
||||
(
|
||||
isGlobal
|
||||
? io.globalFilePath(word::null)
|
||||
: io.localFilePath(word::null)
|
||||
);
|
||||
|
||||
if (!exists(fName))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot find surface starting from "
|
||||
<< io.objectPath() << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
return fName;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::fileFormats::surfaceFormatsCore::checkSupport
|
||||
(
|
||||
const wordHashSet& available,
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -48,9 +49,12 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declarations
|
||||
// Forward Declarations
|
||||
class ISstream;
|
||||
class Time;
|
||||
class triSurface;
|
||||
class IOobject;
|
||||
class dictionary;
|
||||
|
||||
namespace fileFormats
|
||||
{
|
||||
@ -63,10 +67,15 @@ class surfaceFormatsCore
|
||||
{
|
||||
protected:
|
||||
|
||||
// Friendship with triSurface (for IO helpers)
|
||||
friend class ::Foam::triSurface;
|
||||
|
||||
|
||||
// General
|
||||
|
||||
//- Read non-empty and non-comment line
|
||||
static string getLineNoComment(ISstream& is, const char comment='#');
|
||||
|
||||
|
||||
//- Return a surfZone list with a single entry, the size of which
|
||||
//- corresponds to that of the container
|
||||
template<class Container>
|
||||
@ -76,9 +85,41 @@ protected:
|
||||
const word& name = "zone0"
|
||||
)
|
||||
{
|
||||
return List<surfZone>(1, surfZone(name, container.size(), 0, 0));
|
||||
return List<surfZone>(1, surfZone(name, container.size()));
|
||||
}
|
||||
|
||||
|
||||
// IO helpers
|
||||
|
||||
//- Return fileName.
|
||||
// If fileName is relative gets treated as local to IOobject.
|
||||
// Duplicate of triSurfaceMesh::relativeFilePath
|
||||
static fileName relativeFilePath
|
||||
(
|
||||
const IOobject& io,
|
||||
const fileName& f,
|
||||
const bool isGlobal = true //!< resolve as a global file
|
||||
);
|
||||
|
||||
//- Return fileName to load IOobject from.
|
||||
// Fatal if the file does not exist
|
||||
static fileName checkFile
|
||||
(
|
||||
const IOobject& io,
|
||||
const bool isGlobal = true //!< resolve as a global file
|
||||
);
|
||||
|
||||
//- Return fileName to load IOobject from.
|
||||
// Supports optional override of fileName with "file" entry
|
||||
// Fatal if the file does not exist
|
||||
static fileName checkFile
|
||||
(
|
||||
const IOobject& io,
|
||||
const dictionary& dict,
|
||||
const bool isGlobal = true //!< resolve as a global file
|
||||
);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Static Data
|
||||
@ -99,39 +140,57 @@ public:
|
||||
const word& functionName
|
||||
);
|
||||
|
||||
//- Return the local file name (within time directory)
|
||||
// NEEDS FIXING
|
||||
static fileName localMeshFileName
|
||||
//- Use IOobject information to resolve file to load from,
|
||||
//- or empty if the file does not exist.
|
||||
static fileName findFile
|
||||
(
|
||||
const word& surfName = word::null
|
||||
const IOobject& io,
|
||||
const bool isGlobal = true //!< resolve as a global file
|
||||
);
|
||||
|
||||
//- Find instance with surfName
|
||||
// NEEDS FIXING
|
||||
static fileName findMeshInstance
|
||||
//- Use IOobject information to resolve file to load from,
|
||||
//- or empty if the file does not exist.
|
||||
// Supports optional override of fileName with "file" entry
|
||||
static fileName findFile
|
||||
(
|
||||
const Time&,
|
||||
const word& surfName = word::null
|
||||
const IOobject& io,
|
||||
const dictionary& dict,
|
||||
const bool isGlobal = true //!< resolve as a global file
|
||||
);
|
||||
|
||||
//- Find mesh file with surfName
|
||||
// NEEDS FIXING
|
||||
static fileName findMeshFile
|
||||
(
|
||||
const Time&,
|
||||
const word& surfName = word::null
|
||||
);
|
||||
|
||||
// //- Return the local file name (within time directory)
|
||||
// // NEEDS FIXING
|
||||
// static fileName localMeshFileName
|
||||
// (
|
||||
// const word& surfName = word::null
|
||||
// );
|
||||
//
|
||||
// //- Find instance with surfName
|
||||
// // NEEDS FIXING
|
||||
// static fileName findMeshInstance
|
||||
// (
|
||||
// const Time&,
|
||||
// const word& surfName = word::null
|
||||
// );
|
||||
//
|
||||
// //- Find mesh file with surfName
|
||||
// // NEEDS FIXING
|
||||
// static fileName findMeshFile
|
||||
// (
|
||||
// const Time&,
|
||||
// const word& surfName = word::null
|
||||
// );
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
//- Default construct
|
||||
surfaceFormatsCore() = default;
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~surfaceFormatsCore() = default;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -504,10 +504,7 @@ Foam::triSurface::triSurface
|
||||
const scalar scaleFactor
|
||||
)
|
||||
:
|
||||
ParentType(List<Face>(), pointField()),
|
||||
patches_(),
|
||||
sortedEdgeFacesPtr_(nullptr),
|
||||
edgeOwnerPtr_(nullptr)
|
||||
triSurface()
|
||||
{
|
||||
read(name, ext);
|
||||
scalePoints(scaleFactor);
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -51,9 +51,9 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declarations
|
||||
|
||||
// Forward Declarations
|
||||
class Time;
|
||||
class IOobject;
|
||||
class IFstream;
|
||||
class surfZone;
|
||||
class triSurface;
|
||||
@ -240,6 +240,54 @@ public:
|
||||
static const wordHashSet& writeTypes();
|
||||
|
||||
|
||||
// IO helpers
|
||||
|
||||
//- Return fileName.
|
||||
// If fileName is relative gets treated as local to IOobject.
|
||||
static fileName relativeFilePath
|
||||
(
|
||||
const IOobject& io,
|
||||
const fileName& f,
|
||||
const bool isGlobal = true //!< resolve as a global file
|
||||
);
|
||||
|
||||
//- Return fileName to load IOobject from.
|
||||
// Fatal if the file does not exist
|
||||
static fileName checkFile
|
||||
(
|
||||
const IOobject& io,
|
||||
const bool isGlobal = true //!< resolve as a global file
|
||||
);
|
||||
|
||||
//- Return fileName to load IOobject from.
|
||||
// Supports optional override of fileName with "file" entry
|
||||
// Fatal if the file does not exist
|
||||
static fileName checkFile
|
||||
(
|
||||
const IOobject& io,
|
||||
const dictionary& dict,
|
||||
const bool isGlobal = true //!< resolve as a global file
|
||||
);
|
||||
|
||||
//- Use IOobject information to resolve file to load from,
|
||||
//- or empty if the file does not exist.
|
||||
static fileName findFile
|
||||
(
|
||||
const IOobject& io,
|
||||
const bool isGlobal = true //!< resolve as a global file
|
||||
);
|
||||
|
||||
//- Use IOobject information to resolve file to load from,
|
||||
//- or empty if the file does not exist.
|
||||
// Supports optional override of fileName with "file" entry
|
||||
static fileName findFile
|
||||
(
|
||||
const IOobject& io,
|
||||
const dictionary& dict,
|
||||
const bool isGlobal = true //!< resolve as a global file
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
@ -286,7 +334,11 @@ public:
|
||||
|
||||
//- Construct from file name (uses extension to determine type).
|
||||
// Optional (positive, non-zero) point scaling is possible.
|
||||
triSurface(const fileName& name, const scalar scaleFactor = -1);
|
||||
explicit triSurface
|
||||
(
|
||||
const fileName& name,
|
||||
const scalar scaleFactor = -1
|
||||
);
|
||||
|
||||
//- Construct from file name (uses extension to determine type)
|
||||
triSurface
|
||||
@ -297,10 +349,20 @@ public:
|
||||
);
|
||||
|
||||
//- Construct from Istream
|
||||
triSurface(Istream& is);
|
||||
explicit triSurface(Istream& is);
|
||||
|
||||
//- Construct from objectRegistry
|
||||
triSurface(const Time& d);
|
||||
//- Construct from objectRegistry by reading an ".ftr" file
|
||||
explicit triSurface(const Time& d);
|
||||
|
||||
//- Read construct using IO to find the file location.
|
||||
// Dictionary may contain optional 'file' entry, and an
|
||||
// optional 'scale' entry (eg, 0.001: mm -> m)
|
||||
triSurface
|
||||
(
|
||||
const IOobject& io,
|
||||
const dictionary& dict,
|
||||
const bool isGlobal = true //!< resolve as a global file
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -104,6 +104,62 @@ bool Foam::triSurface::canRead(const fileName& name, const bool verbose)
|
||||
return canReadType(ext, verbose);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Foam::fileName Foam::triSurface::relativeFilePath
|
||||
(
|
||||
const IOobject& io,
|
||||
const fileName& f,
|
||||
const bool isGlobal
|
||||
)
|
||||
{
|
||||
return fileFormats::surfaceFormatsCore::relativeFilePath(io, f, isGlobal);
|
||||
}
|
||||
|
||||
|
||||
Foam::fileName Foam::triSurface::checkFile
|
||||
(
|
||||
const IOobject& io,
|
||||
const bool isGlobal
|
||||
)
|
||||
{
|
||||
return fileFormats::surfaceFormatsCore::checkFile(io, isGlobal);
|
||||
}
|
||||
|
||||
|
||||
Foam::fileName Foam::triSurface::checkFile
|
||||
(
|
||||
const IOobject& io,
|
||||
const dictionary& dict,
|
||||
const bool isGlobal
|
||||
)
|
||||
{
|
||||
return fileFormats::surfaceFormatsCore::checkFile(io, dict, isGlobal);
|
||||
}
|
||||
|
||||
|
||||
Foam::fileName Foam::triSurface::findFile
|
||||
(
|
||||
const IOobject& io,
|
||||
const bool isGlobal
|
||||
)
|
||||
{
|
||||
return fileFormats::surfaceFormatsCore::findFile(io, isGlobal);
|
||||
}
|
||||
|
||||
|
||||
Foam::fileName Foam::triSurface::findFile
|
||||
(
|
||||
const IOobject& io,
|
||||
const dictionary& dict,
|
||||
const bool isGlobal
|
||||
)
|
||||
{
|
||||
return fileFormats::surfaceFormatsCore::findFile(io, dict, isGlobal);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::triSurface::printTriangle
|
||||
@ -143,7 +199,8 @@ bool Foam::triSurface::read
|
||||
if (check && !exists(name))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannnot read " << name << exit(FatalError);
|
||||
<< "Cannnot read " << name << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
if (ext == "gz")
|
||||
@ -257,10 +314,7 @@ void Foam::triSurface::write
|
||||
|
||||
Foam::triSurface::triSurface(Istream& is)
|
||||
:
|
||||
ParentType(List<Face>(), pointField()),
|
||||
patches_(),
|
||||
sortedEdgeFacesPtr_(nullptr),
|
||||
edgeOwnerPtr_(nullptr)
|
||||
triSurface()
|
||||
{
|
||||
read(is);
|
||||
|
||||
@ -270,10 +324,7 @@ Foam::triSurface::triSurface(Istream& is)
|
||||
|
||||
Foam::triSurface::triSurface(const Time& d)
|
||||
:
|
||||
ParentType(List<Face>(), pointField()),
|
||||
patches_(),
|
||||
sortedEdgeFacesPtr_(nullptr),
|
||||
edgeOwnerPtr_(nullptr)
|
||||
triSurface()
|
||||
{
|
||||
fileName foamFile(d.caseName() + ".ftr");
|
||||
|
||||
@ -287,6 +338,29 @@ Foam::triSurface::triSurface(const Time& d)
|
||||
}
|
||||
|
||||
|
||||
Foam::triSurface::triSurface
|
||||
(
|
||||
const IOobject& io,
|
||||
const dictionary& dict,
|
||||
const bool isGlobal
|
||||
)
|
||||
:
|
||||
triSurface()
|
||||
{
|
||||
fileName fName(checkFile(io, dict, isGlobal));
|
||||
|
||||
// TBD:
|
||||
// word fileExt = dict.getOrDefault<word>("surfaceType", fName.ext());
|
||||
// read(fName, ext);
|
||||
|
||||
read(fName, fName.ext());
|
||||
|
||||
scalePoints(dict.getOrDefault<scalar>("scale", 0));
|
||||
|
||||
setDefaultPatches();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::triSurface::write
|
||||
|
||||
Reference in New Issue
Block a user