mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
surfMesh, surfaceRegistry re-working
This commit is contained in:
@ -83,10 +83,24 @@ int main(int argc, char *argv[])
|
||||
argList::validOptions.insert("from", "sourceCoordinateSystem");
|
||||
argList::validOptions.insert("to", "targetCoordinateSystem");
|
||||
|
||||
argList args(argc, argv);
|
||||
Time runTime(args.rootPath(), args.caseName());
|
||||
# include "setRootCase.H"
|
||||
# include "createTime.H"
|
||||
|
||||
const stringList& params = args.additionalArgs();
|
||||
|
||||
// try for the latestTime, but create "constant" as needed
|
||||
instantList Times = runTime.times();
|
||||
if (Times.size())
|
||||
{
|
||||
label startTime = Times.size()-1;
|
||||
runTime.setTime(Times[startTime], startTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
runTime.setTime(instant(0, runTime.constant()), 0);
|
||||
}
|
||||
|
||||
|
||||
fileName importName(params[0]);
|
||||
word exportName("default");
|
||||
|
||||
@ -201,7 +215,6 @@ int main(int argc, char *argv[])
|
||||
|
||||
|
||||
|
||||
|
||||
MeshedSurface<face> surf(importName);
|
||||
|
||||
if (args.options().found("clean"))
|
||||
|
||||
@ -59,7 +59,8 @@ class BasicMeshedSurface
|
||||
public PrimitivePatch<Face, ::Foam::List, pointField, point>
|
||||
{
|
||||
|
||||
//- Typedefs for convenience
|
||||
// Private typedefs
|
||||
|
||||
typedef PrimitivePatch
|
||||
<
|
||||
Face,
|
||||
@ -70,6 +71,7 @@ class BasicMeshedSurface
|
||||
ParentType;
|
||||
|
||||
protected:
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Non-const access to global points
|
||||
@ -160,14 +162,12 @@ public:
|
||||
const bool verbose=false
|
||||
);
|
||||
|
||||
//- Triangulate in-place
|
||||
// Returning the number of triangles added
|
||||
// Optionally returning a map of original face Ids (zero-sized when
|
||||
// no triangulation was done)
|
||||
//- Triangulate in-place, returning the number of triangles added
|
||||
virtual label triangulate();
|
||||
|
||||
//- Triangulate in-place, setting a map of original face Ids
|
||||
// faceMap is zero-sized when no triangulation was done
|
||||
//- Triangulate in-place, returning the number of triangles added
|
||||
// and setting a map of original face Ids.
|
||||
// The faceMap is zero-sized when no triangulation was done.
|
||||
virtual label triangulate(List<label>& faceMap);
|
||||
|
||||
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/triSurface/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-ltriSurface
|
||||
|
||||
@ -340,9 +340,9 @@ Foam::MeshedSurface<Face>::MeshedSurface(Istream& is)
|
||||
|
||||
|
||||
template<class Face>
|
||||
Foam::MeshedSurface<Face>::MeshedSurface(const Time& d)
|
||||
Foam::MeshedSurface<Face>::MeshedSurface(const Time& d, const word& surfName)
|
||||
{
|
||||
read(IFstream(findMeshName(d))());
|
||||
read(IFstream(findMeshFile(d, surfName))());
|
||||
}
|
||||
|
||||
|
||||
@ -822,9 +822,9 @@ bool Foam::MeshedSurface<Face>::read
|
||||
|
||||
|
||||
template<class Face>
|
||||
void Foam::MeshedSurface<Face>::write(const Time& d) const
|
||||
void Foam::MeshedSurface<Face>::write(const Time& d, const word& surfName) const
|
||||
{
|
||||
write(OFstream(findMeshName(d))());
|
||||
write(OFstream(findMeshFile(d, surfName))());
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
@ -204,7 +204,7 @@ public:
|
||||
MeshedSurface(Istream&);
|
||||
|
||||
//- Construct from objectRegistry
|
||||
MeshedSurface(const Time&);
|
||||
MeshedSurface(const Time&, const word& surfName="");
|
||||
|
||||
//- Construct as copy
|
||||
MeshedSurface(const MeshedSurface&);
|
||||
@ -348,7 +348,7 @@ public:
|
||||
}
|
||||
|
||||
//- Write to database
|
||||
void write(const Time&) const;
|
||||
void write(const Time&, const word& surfName="") const;
|
||||
|
||||
|
||||
// Member operators
|
||||
|
||||
@ -25,17 +25,6 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "MeshedSurface.H"
|
||||
#include "UnsortedMeshedSurface.H"
|
||||
#include "IFstream.H"
|
||||
#include "OFstream.H"
|
||||
#include "Time.H"
|
||||
#include "ListOps.H"
|
||||
#include "polyBoundaryMesh.H"
|
||||
#include "polyMesh.H"
|
||||
#include "surfMesh.H"
|
||||
#include "primitivePatch.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -253,9 +253,13 @@ Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface(Istream& is)
|
||||
|
||||
|
||||
template<class Face>
|
||||
Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface(const Time& d)
|
||||
Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface
|
||||
(
|
||||
const Time& d,
|
||||
const word& surfName
|
||||
)
|
||||
{
|
||||
read(IFstream(findMeshName(d))());
|
||||
read(IFstream(findMeshFile(d, surfName))());
|
||||
}
|
||||
|
||||
|
||||
@ -631,9 +635,13 @@ bool Foam::UnsortedMeshedSurface<Face>::read
|
||||
|
||||
|
||||
template<class Face>
|
||||
void Foam::UnsortedMeshedSurface<Face>::write(const Time& d) const
|
||||
void Foam::UnsortedMeshedSurface<Face>::write
|
||||
(
|
||||
const Time& d,
|
||||
const word& surfName
|
||||
) const
|
||||
{
|
||||
write(OFstream(findMeshName(d))());
|
||||
write(OFstream(findMeshFile(d, surfName))());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -208,7 +208,7 @@ public:
|
||||
UnsortedMeshedSurface(Istream&);
|
||||
|
||||
//- Construct from objectRegistry
|
||||
UnsortedMeshedSurface(const Time&);
|
||||
UnsortedMeshedSurface(const Time&, const word& surfName="");
|
||||
|
||||
//- Construct as copy
|
||||
UnsortedMeshedSurface(const UnsortedMeshedSurface<Face>&);
|
||||
@ -364,7 +364,7 @@ public:
|
||||
}
|
||||
|
||||
//- Write to database
|
||||
void write(const Time&) const;
|
||||
void write(const Time&, const word& surfName="") const;
|
||||
|
||||
|
||||
// Member operators
|
||||
|
||||
@ -36,10 +36,8 @@ License
|
||||
|
||||
defineTypeNameAndDebug(Foam::surfMesh, 0);
|
||||
|
||||
Foam::word Foam::surfMesh::defaultName = "default";
|
||||
Foam::word Foam::surfMesh::meshSubDir = "surfMesh";
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::surfMesh::oneZone()
|
||||
@ -69,9 +67,10 @@ void Foam::surfMesh::oneZone()
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::surfMesh::surfMesh(const IOobject& io)
|
||||
|
||||
Foam::surfMesh::surfMesh(const IOobject& io, const word& surfName)
|
||||
:
|
||||
surfaceRegistry(io.db(), io.name()),
|
||||
surfaceRegistry(io.db(), (surfName.size() ? surfName : io.name())),
|
||||
surfMeshAllocator
|
||||
(
|
||||
IOobject
|
||||
@ -93,7 +92,7 @@ Foam::surfMesh::surfMesh(const IOobject& io)
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
),
|
||||
MeshReference(ioFaces_, ioPoints_),
|
||||
MeshReference(storedFaces_, storedPoints_),
|
||||
surfZones_
|
||||
(
|
||||
IOobject
|
||||
@ -114,10 +113,10 @@ Foam::surfMesh::surfMesh
|
||||
const IOobject& io,
|
||||
const Xfer<pointField>& pointLst,
|
||||
const Xfer<faceList>& faceLst,
|
||||
const bool syncPar
|
||||
const word& surfName
|
||||
)
|
||||
:
|
||||
surfaceRegistry(io, io.name()),
|
||||
surfaceRegistry(io.db(), (surfName.size() ? surfName : io.name())),
|
||||
surfMeshAllocator
|
||||
(
|
||||
IOobject
|
||||
@ -141,7 +140,7 @@ Foam::surfMesh::surfMesh
|
||||
),
|
||||
faceLst
|
||||
),
|
||||
MeshReference(ioFaces_, ioPoints_),
|
||||
MeshReference(storedFaces_, storedPoints_),
|
||||
surfZones_
|
||||
(
|
||||
IOobject
|
||||
@ -157,62 +156,14 @@ Foam::surfMesh::surfMesh
|
||||
{}
|
||||
|
||||
|
||||
Foam::surfMesh::surfMesh
|
||||
(
|
||||
const IOobject& io,
|
||||
const MeshedSurface<face>& surf,
|
||||
const bool syncPar
|
||||
)
|
||||
:
|
||||
surfaceRegistry(io, io.name()),
|
||||
surfMeshAllocator
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"points",
|
||||
instance(),
|
||||
meshSubDir,
|
||||
*this,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
surf.points(),
|
||||
IOobject
|
||||
(
|
||||
"faces",
|
||||
instance(),
|
||||
meshSubDir,
|
||||
*this,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
surf.faces()
|
||||
),
|
||||
MeshReference(ioFaces_, ioPoints_),
|
||||
surfZones_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"surfZones",
|
||||
instance(),
|
||||
meshSubDir,
|
||||
*this,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
surf.zones()
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
Foam::surfMesh::surfMesh
|
||||
(
|
||||
const IOobject& io,
|
||||
const Xfer< MeshedSurface<face> >& surf,
|
||||
const bool syncPar
|
||||
const word& surfName
|
||||
)
|
||||
:
|
||||
surfaceRegistry(io, io.name()),
|
||||
surfaceRegistry(io.db(), (surfName.size() ? surfName : io.name())),
|
||||
surfMeshAllocator
|
||||
(
|
||||
IOobject
|
||||
@ -236,7 +187,7 @@ Foam::surfMesh::surfMesh
|
||||
),
|
||||
faceList()
|
||||
),
|
||||
MeshReference(ioFaces_, ioPoints_),
|
||||
MeshReference(storedFaces_, storedPoints_),
|
||||
surfZones_
|
||||
(
|
||||
IOobject
|
||||
@ -250,9 +201,13 @@ Foam::surfMesh::surfMesh
|
||||
),
|
||||
surfZoneList()
|
||||
)
|
||||
{
|
||||
// We can also send Xfer<..>::null just to force initialization
|
||||
if (&surf)
|
||||
{
|
||||
transfer(surf());
|
||||
}
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -280,12 +235,12 @@ void Foam::surfMesh::resetPrimitives
|
||||
// Optimized to avoid overwriting data at all
|
||||
if (&points)
|
||||
{
|
||||
ioPoints_.transfer(points());
|
||||
storedPoints_.transfer(points());
|
||||
}
|
||||
|
||||
if (&faces)
|
||||
{
|
||||
ioFaces_.transfer(faces());
|
||||
storedFaces_.transfer(faces());
|
||||
}
|
||||
|
||||
if (&zones)
|
||||
@ -308,21 +263,19 @@ void Foam::surfMesh::transfer
|
||||
// Clear addressing.
|
||||
MeshReference::clearGeom();
|
||||
|
||||
ioPoints_.transfer(surf.storedPoints());
|
||||
ioFaces_.transfer(surf.storedFaces());
|
||||
storedPoints_.transfer(surf.storedPoints());
|
||||
storedFaces_.transfer(surf.storedFaces());
|
||||
surfZones_.transfer(surf.storedZones());
|
||||
}
|
||||
|
||||
|
||||
void Foam::surfMesh::rename(const word& newName)
|
||||
{
|
||||
surfaceRegistry::rename(newName);
|
||||
FatalErrorIn
|
||||
(
|
||||
"surfMesh::rename(const word&)\n"
|
||||
)
|
||||
<< "rename does not work correctly\n"
|
||||
<< exit(FatalError);
|
||||
<< "rename does not work correctly\n";
|
||||
}
|
||||
|
||||
|
||||
@ -335,34 +288,34 @@ Foam::fileName Foam::surfMesh::meshDir() const
|
||||
|
||||
const Foam::fileName& Foam::surfMesh::pointsInstance() const
|
||||
{
|
||||
return ioPoints_.instance();
|
||||
return storedPoints_.instance();
|
||||
}
|
||||
|
||||
|
||||
const Foam::fileName& Foam::surfMesh::facesInstance() const
|
||||
{
|
||||
return ioFaces_.instance();
|
||||
return storedFaces_.instance();
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::surfMesh::nPoints() const
|
||||
{
|
||||
return ioPoints_.size();
|
||||
return storedPoints_.size();
|
||||
}
|
||||
|
||||
Foam::label Foam::surfMesh::nFaces() const
|
||||
{
|
||||
return ioFaces_.size();
|
||||
return storedFaces_.size();
|
||||
}
|
||||
|
||||
const Foam::pointField& Foam::surfMesh::points() const
|
||||
{
|
||||
return ioPoints_;
|
||||
return storedPoints_;
|
||||
}
|
||||
|
||||
const Foam::faceList& Foam::surfMesh::faces() const
|
||||
{
|
||||
return ioFaces_;
|
||||
return storedFaces_;
|
||||
}
|
||||
|
||||
void Foam::surfMesh::checkZones()
|
||||
|
||||
@ -63,13 +63,13 @@ class MeshedSurface;
|
||||
class surfMeshAllocator
|
||||
{
|
||||
protected:
|
||||
pointIOField ioPoints_;
|
||||
faceIOList ioFaces_;
|
||||
pointIOField storedPoints_;
|
||||
faceIOList storedFaces_;
|
||||
|
||||
surfMeshAllocator(const IOobject& ioPoints, const IOobject& ioFaces)
|
||||
:
|
||||
ioPoints_(ioPoints),
|
||||
ioFaces_(ioFaces)
|
||||
storedPoints_(ioPoints),
|
||||
storedFaces_(ioFaces)
|
||||
{}
|
||||
|
||||
surfMeshAllocator
|
||||
@ -80,8 +80,8 @@ protected:
|
||||
const faceList& faces
|
||||
)
|
||||
:
|
||||
ioPoints_(ioPoints, points),
|
||||
ioFaces_(ioFaces, faces)
|
||||
storedPoints_(ioPoints, points),
|
||||
storedFaces_(ioFaces, faces)
|
||||
{}
|
||||
|
||||
surfMeshAllocator
|
||||
@ -92,8 +92,8 @@ protected:
|
||||
const Xfer<faceList>& faces
|
||||
)
|
||||
:
|
||||
ioPoints_(ioPoints, points),
|
||||
ioFaces_(ioFaces, faces)
|
||||
storedPoints_(ioPoints, points),
|
||||
storedFaces_(ioFaces, faces)
|
||||
{}
|
||||
|
||||
};
|
||||
@ -160,6 +160,28 @@ private:
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const surfMesh&);
|
||||
|
||||
protected:
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Non-const access to global points
|
||||
pointIOField& storedPoints()
|
||||
{
|
||||
return surfMeshAllocator::storedPoints_;
|
||||
}
|
||||
|
||||
//- Non-const access to the faces
|
||||
faceIOList& storedFaces()
|
||||
{
|
||||
return surfMeshAllocator::storedFaces_;
|
||||
}
|
||||
|
||||
//- Non-const access to the zones
|
||||
surfZoneIOList& storedZones()
|
||||
{
|
||||
return surfZones_;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// Public typedefs
|
||||
@ -170,20 +192,13 @@ public:
|
||||
//- Runtime type information
|
||||
TypeName("surfMesh");
|
||||
|
||||
//- Return the default surface name
|
||||
static word defaultName;
|
||||
|
||||
//- Return the mesh sub-directory name (usually "surfMesh")
|
||||
//- Return the mesh sub-directory name (normally "surfMesh")
|
||||
static word meshSubDir;
|
||||
|
||||
//- Return the default zone name
|
||||
static word defaultZoneName;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from IOobject
|
||||
explicit surfMesh(const IOobject& io);
|
||||
//- Construct from IOobject, with alternative surface name
|
||||
explicit surfMesh(const IOobject&, const word& surfName="");
|
||||
|
||||
//- Construct by transferring components (points, faces) without zones.
|
||||
// surfZones are added using addZones() member function
|
||||
@ -192,23 +207,15 @@ public:
|
||||
const IOobject&,
|
||||
const Xfer<pointField>&,
|
||||
const Xfer<faceList>&,
|
||||
const bool syncPar=true
|
||||
const word& surfName=""
|
||||
);
|
||||
|
||||
//- Construct copy from MeshedSurface
|
||||
surfMesh
|
||||
(
|
||||
const IOobject&,
|
||||
const MeshedSurface<face>& surf,
|
||||
const bool syncPar=true
|
||||
);
|
||||
|
||||
//- Construct copy from MeshedSurface
|
||||
//- Construct copy/move from MeshedSurface
|
||||
surfMesh
|
||||
(
|
||||
const IOobject&,
|
||||
const Xfer< MeshedSurface<face> >& surf,
|
||||
const bool syncPar=true
|
||||
const word& surfName=""
|
||||
);
|
||||
|
||||
// Destructor
|
||||
@ -224,7 +231,7 @@ public:
|
||||
fileName meshDir() const;
|
||||
|
||||
//- Return the current instance directory for points
|
||||
// Used in the consruction of gemometric mesh data dependent
|
||||
// Used in the consruction of geometric mesh data dependent
|
||||
// on points
|
||||
const fileName& pointsInstance() const;
|
||||
|
||||
@ -300,6 +307,7 @@ public:
|
||||
);
|
||||
|
||||
|
||||
//- Transfer the contents of the argument and annull the argument
|
||||
void transfer(MeshedSurface<face>&);
|
||||
|
||||
// Storage management
|
||||
|
||||
@ -37,11 +37,11 @@ void Foam::surfMesh::setInstance(const fileName& inst)
|
||||
<< "Resetting file instance to " << inst << endl;
|
||||
}
|
||||
|
||||
ioPoints_.writeOpt() = IOobject::AUTO_WRITE;
|
||||
ioPoints_.instance() = inst;
|
||||
storedPoints_.writeOpt() = IOobject::AUTO_WRITE;
|
||||
storedPoints_.instance() = inst;
|
||||
|
||||
ioFaces_.writeOpt() = IOobject::AUTO_WRITE;
|
||||
ioFaces_.instance() = inst;
|
||||
storedFaces_.writeOpt() = IOobject::AUTO_WRITE;
|
||||
storedFaces_.instance() = inst;
|
||||
|
||||
surfZones_.writeOpt() = IOobject::AUTO_WRITE;
|
||||
surfZones_.instance() = inst;
|
||||
@ -56,16 +56,16 @@ Foam::surfMesh::readUpdateState Foam::surfMesh::readUpdate()
|
||||
<< "Updating mesh based on saved data." << endl;
|
||||
}
|
||||
|
||||
// Find the point and cell instance
|
||||
// Find point and face instances
|
||||
fileName pointsInst(time().findInstance(meshDir(), "points"));
|
||||
fileName facesInst(time().findInstance(meshDir(), "faces"));
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "Faces instance: old = " << facesInstance()
|
||||
<< " new = " << facesInst << nl
|
||||
<< "Points instance: old = " << pointsInstance()
|
||||
<< " new = " << pointsInst << endl;
|
||||
Info<< "Points instance: old = " << pointsInstance()
|
||||
<< " new = " << pointsInst << nl
|
||||
<< "Faces instance: old = " << facesInstance()
|
||||
<< " new = " << facesInst << endl;
|
||||
}
|
||||
|
||||
if (facesInst != facesInstance())
|
||||
@ -78,12 +78,12 @@ Foam::surfMesh::readUpdateState Foam::surfMesh::readUpdate()
|
||||
|
||||
clearOut();
|
||||
|
||||
// Set instance to new instance. Note that points instance can differ
|
||||
// from from faces instance.
|
||||
// Set instance to new instance.
|
||||
// Note points instance can differ from faces instance.
|
||||
setInstance(facesInst);
|
||||
ioPoints_.instance() = pointsInst;
|
||||
storedPoints_.instance() = pointsInst;
|
||||
|
||||
ioPoints_ = pointIOField
|
||||
storedPoints_ = pointIOField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
@ -97,7 +97,7 @@ Foam::surfMesh::readUpdateState Foam::surfMesh::readUpdate()
|
||||
)
|
||||
);
|
||||
|
||||
ioFaces_ = faceIOList
|
||||
storedFaces_ = faceIOList
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
@ -111,10 +111,8 @@ Foam::surfMesh::readUpdateState Foam::surfMesh::readUpdate()
|
||||
)
|
||||
);
|
||||
|
||||
// synchronize the sizes
|
||||
MeshReference newMeshRef(ioFaces_, ioPoints_);
|
||||
MeshReference::operator=(newMeshRef);
|
||||
|
||||
// synchronize sizes and references?
|
||||
// MeshReference::operator=(MeshReference(storedFaces_, storedPoints_));
|
||||
|
||||
// Reset the surface zones
|
||||
surfZoneIOList newZones
|
||||
@ -150,27 +148,21 @@ Foam::surfMesh::readUpdateState Foam::surfMesh::readUpdate()
|
||||
}
|
||||
}
|
||||
|
||||
surfZones_.transfer(newZones);
|
||||
|
||||
if (zonesChanged)
|
||||
{
|
||||
WarningIn("surfMesh::readUpdateState surfMesh::readUpdate()")
|
||||
<< "Number of zones has changed. This may have "
|
||||
<< "unexpected consequences. Proceed with care." << endl;
|
||||
|
||||
surfZones_.transfer(newZones);
|
||||
}
|
||||
else
|
||||
{
|
||||
surfZones_.transfer(newZones);
|
||||
}
|
||||
|
||||
if (zonesChanged)
|
||||
{
|
||||
return surfMesh::TOPO_PATCH_CHANGE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return surfMesh::TOPO_CHANGE;
|
||||
}
|
||||
|
||||
}
|
||||
else if (pointsInst != pointsInstance())
|
||||
{
|
||||
@ -182,9 +174,9 @@ Foam::surfMesh::readUpdateState Foam::surfMesh::readUpdate()
|
||||
|
||||
clearGeom();
|
||||
|
||||
ioPoints_.instance() = pointsInst;
|
||||
storedPoints_.instance() = pointsInst;
|
||||
|
||||
ioPoints_ = pointIOField
|
||||
storedPoints_ = pointIOField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
@ -206,10 +198,10 @@ Foam::surfMesh::readUpdateState Foam::surfMesh::readUpdate()
|
||||
{
|
||||
Info << "No change" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
return surfMesh::UNCHANGED;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -29,10 +29,10 @@ License
|
||||
#include "OFstream.H"
|
||||
#include "Time.H"
|
||||
#include "SortableList.H"
|
||||
#include "surfMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
Foam::word Foam::fileFormats::surfaceFormatsCore::meshSubDir("meshedSurface");
|
||||
Foam::word Foam::fileFormats::surfaceFormatsCore::nativeExt("ofs");
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
@ -61,14 +61,29 @@ Foam::fileFormats::surfaceFormatsCore::getLineNoComment
|
||||
}
|
||||
|
||||
|
||||
Foam::fileName
|
||||
Foam::fileFormats::surfaceFormatsCore::localMeshFileName(const word& surfName)
|
||||
{
|
||||
const word name(surfName.size() ? surfName : surfaceRegistry::defaultName);
|
||||
|
||||
return fileName
|
||||
(
|
||||
surfaceRegistry::subInstance
|
||||
/ name
|
||||
/ surfMesh::meshSubDir
|
||||
/ name + "." + nativeExt
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::fileName
|
||||
Foam::fileFormats::surfaceFormatsCore::findMeshInstance
|
||||
(
|
||||
const Time& d,
|
||||
const word& subdirName
|
||||
const word& surfName
|
||||
)
|
||||
{
|
||||
fileName foamName(d.caseName() + "." + nativeExt);
|
||||
fileName localName = localMeshFileName(surfName);
|
||||
|
||||
// Search back through the time directories list to find the time
|
||||
// closest to and lower than current time
|
||||
@ -91,7 +106,7 @@ Foam::fileFormats::surfaceFormatsCore::findMeshInstance
|
||||
{
|
||||
for (label i = instanceI; i >= 0; --i)
|
||||
{
|
||||
if (isFile(d.path()/ts[i].name()/subdirName/foamName))
|
||||
if (isFile(d.path()/ts[i].name()/localName))
|
||||
{
|
||||
return ts[i].name();
|
||||
}
|
||||
@ -103,13 +118,13 @@ Foam::fileFormats::surfaceFormatsCore::findMeshInstance
|
||||
|
||||
|
||||
Foam::fileName
|
||||
Foam::fileFormats::surfaceFormatsCore::findMeshName
|
||||
Foam::fileFormats::surfaceFormatsCore::findMeshFile
|
||||
(
|
||||
const Time& d,
|
||||
const word& subdirName
|
||||
const word& surfName
|
||||
)
|
||||
{
|
||||
fileName foamName(d.caseName() + "." + nativeExt);
|
||||
fileName localName = localMeshFileName(surfName);
|
||||
|
||||
// Search back through the time directories list to find the time
|
||||
// closest to and lower than current time
|
||||
@ -132,7 +147,7 @@ Foam::fileFormats::surfaceFormatsCore::findMeshName
|
||||
{
|
||||
for (label i = instanceI; i >= 0; --i)
|
||||
{
|
||||
fileName testName(d.path()/ts[i].name()/subdirName/foamName);
|
||||
fileName testName(d.path()/ts[i].name()/localName);
|
||||
|
||||
if (isFile(testName))
|
||||
{
|
||||
@ -141,27 +156,8 @@ Foam::fileFormats::surfaceFormatsCore::findMeshName
|
||||
}
|
||||
}
|
||||
|
||||
return d.path()/"constant"/subdirName/foamName;
|
||||
}
|
||||
|
||||
|
||||
Foam::fileName
|
||||
Foam::fileFormats::surfaceFormatsCore::findMeshInstance
|
||||
(
|
||||
const Time& d
|
||||
)
|
||||
{
|
||||
return findMeshInstance(d, meshSubDir);
|
||||
}
|
||||
|
||||
|
||||
Foam::fileName
|
||||
Foam::fileFormats::surfaceFormatsCore::findMeshName
|
||||
(
|
||||
const Time& d
|
||||
)
|
||||
{
|
||||
return findMeshName(d, meshSubDir);
|
||||
// fallback to "constant"
|
||||
return d.path()/"constant"/localName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -65,9 +65,6 @@ public:
|
||||
|
||||
// Static Data
|
||||
|
||||
//- Return the mesh sub-directory name (usually "meshedSurface")
|
||||
static word meshSubDir;
|
||||
|
||||
//- The file extension corresponding to 'native' surface format
|
||||
// Normally "ofs" (mnemonic: OF = OpenFOAM, S = Surface)
|
||||
static word nativeExt;
|
||||
@ -80,17 +77,14 @@ public:
|
||||
//- Read non-comment line
|
||||
static string getLineNoComment(IFstream&);
|
||||
|
||||
//- Name of UnsortedMeshedSurface directory to use.
|
||||
static fileName findMeshInstance(const Time&, const word& subdirName);
|
||||
//- Return the local file name (within time directory)
|
||||
static fileName localMeshFileName(const word& surfName="");
|
||||
|
||||
//- Name of UnsortedMeshedSurface directory to use.
|
||||
static fileName findMeshName(const Time&, const word& subdirName);
|
||||
//- Find instance with surfName
|
||||
static fileName findMeshInstance(const Time&, const word& surfName="");
|
||||
|
||||
//- Name of UnsortedMeshedSurface directory to use.
|
||||
static fileName findMeshInstance(const Time&);
|
||||
|
||||
//- Name of UnsortedMeshedSurface directory to use.
|
||||
static fileName findMeshName(const Time&);
|
||||
//- Find mesh file with surfName
|
||||
static fileName findMeshFile(const Time&, const word& surfName="");
|
||||
|
||||
//- Determine the sort order from the zone ids.
|
||||
// Returns zone list and sets faceMap to indices within faceLst
|
||||
|
||||
@ -31,21 +31,27 @@ License
|
||||
|
||||
defineTypeNameAndDebug(Foam::surfaceRegistry, 0);
|
||||
|
||||
const Foam::word Foam::surfaceRegistry::subInstance("surfaces");
|
||||
Foam::word Foam::surfaceRegistry::defaultName("default");
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::surfaceRegistry::surfaceRegistry(const IOobject& io, const word& name)
|
||||
Foam::surfaceRegistry::surfaceRegistry
|
||||
(
|
||||
const objectRegistry& obr,
|
||||
const word& surfName
|
||||
)
|
||||
:
|
||||
objectRegistry
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
name,
|
||||
( io.instance().size() ? io.instance() : "constant" ),
|
||||
"surfaces",
|
||||
io.db(),
|
||||
io.readOpt(),
|
||||
io.writeOpt(),
|
||||
io.registerObject()
|
||||
( surfName.size() ? surfName : defaultName ),
|
||||
obr.time().timeName(),
|
||||
subInstance,
|
||||
obr,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
)
|
||||
{}
|
||||
|
||||
@ -66,11 +66,16 @@ public:
|
||||
//- Runtime type information
|
||||
TypeName("surfaceRegistry");
|
||||
|
||||
//- The subInstance (local) to prefix: %surfaces
|
||||
static const word subInstance;
|
||||
|
||||
//- The default surface name: %default
|
||||
static word defaultName;
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for the given objectRegistry and named instance
|
||||
explicit surfaceRegistry(const IOobject&, const word& name="default");
|
||||
//- Construct for the given objectRegistry and named surface
|
||||
surfaceRegistry(const objectRegistry&, const word& surfName = "");
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
Reference in New Issue
Block a user