mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
surfMesh changes
- use new HashSet capabilities and sortedOrder function - make STL format a MeshedSurface instead of an UnsortedMeshedSurface for better (MeshedSurface) reader efficiency
This commit is contained in:
@ -29,7 +29,6 @@ License
|
|||||||
#include "IFstream.H"
|
#include "IFstream.H"
|
||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "SortableList.H"
|
|
||||||
#include "ListOps.H"
|
#include "ListOps.H"
|
||||||
#include "polyBoundaryMesh.H"
|
#include "polyBoundaryMesh.H"
|
||||||
#include "polyMesh.H"
|
#include "polyMesh.H"
|
||||||
@ -42,38 +41,14 @@ License
|
|||||||
template<class Face>
|
template<class Face>
|
||||||
Foam::wordHashSet Foam::MeshedSurface<Face>::readTypes()
|
Foam::wordHashSet Foam::MeshedSurface<Face>::readTypes()
|
||||||
{
|
{
|
||||||
wordHashSet known(2*fileExtensionConstructorTablePtr_->size());
|
return wordHashSet(*fileExtensionConstructorTablePtr_);
|
||||||
|
|
||||||
forAllIter
|
|
||||||
(
|
|
||||||
typename fileExtensionConstructorTable::iterator,
|
|
||||||
*fileExtensionConstructorTablePtr_,
|
|
||||||
iter
|
|
||||||
)
|
|
||||||
{
|
|
||||||
known.insert(iter.key());
|
|
||||||
}
|
|
||||||
|
|
||||||
return known;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Face>
|
template<class Face>
|
||||||
Foam::wordHashSet Foam::MeshedSurface<Face>::writeTypes()
|
Foam::wordHashSet Foam::MeshedSurface<Face>::writeTypes()
|
||||||
{
|
{
|
||||||
wordHashSet supported(2*writefileExtensionMemberFunctionTablePtr_->size());
|
return wordHashSet(*writefileExtensionMemberFunctionTablePtr_);
|
||||||
|
|
||||||
forAllIter
|
|
||||||
(
|
|
||||||
typename writefileExtensionMemberFunctionTable::iterator,
|
|
||||||
*writefileExtensionMemberFunctionTablePtr_,
|
|
||||||
iter
|
|
||||||
)
|
|
||||||
{
|
|
||||||
supported.insert(iter.key());
|
|
||||||
}
|
|
||||||
|
|
||||||
return supported;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -91,11 +66,16 @@ bool Foam::MeshedSurface<Face>::canReadType
|
|||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
wordHashSet available = readTypes();
|
{
|
||||||
available += SiblingType::readTypes();
|
return checkSupport
|
||||||
|
(
|
||||||
return checkSupport(available, ext, verbose, "reading");
|
readTypes() | SiblingType::readTypes(),
|
||||||
|
ext,
|
||||||
|
verbose,
|
||||||
|
"reading"
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -141,8 +121,9 @@ void Foam::MeshedSurface<Face>::write
|
|||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "MeshedSurface::write(const fileName&, const MeshedSurface&) : "
|
Info<< "MeshedSurface::write"
|
||||||
"writing MeshedSurface to " << fName
|
"(const fileName&, const MeshedSurface&) : "
|
||||||
|
"writing to " << fName
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -69,7 +69,7 @@ Foam::MeshedSurface<Face>::New
|
|||||||
(
|
(
|
||||||
"MeshedSurface<Face>::New"
|
"MeshedSurface<Face>::New"
|
||||||
"(const fileName&, const word&) : "
|
"(const fileName&, const word&) : "
|
||||||
"constructing UnsortedMeshedSurface"
|
"constructing MeshedSurface"
|
||||||
) << "Unknown file extension " << ext << nl << nl
|
) << "Unknown file extension " << ext << nl << nl
|
||||||
<< "Valid types are :" << nl
|
<< "Valid types are :" << nl
|
||||||
<< supported
|
<< supported
|
||||||
|
|||||||
@ -29,11 +29,8 @@ License
|
|||||||
#include "IFstream.H"
|
#include "IFstream.H"
|
||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "boundBox.H"
|
|
||||||
#include "polyBoundaryMesh.H"
|
#include "polyBoundaryMesh.H"
|
||||||
#include "polyMesh.H"
|
#include "polyMesh.H"
|
||||||
#include "primitivePatch.H"
|
|
||||||
#include "SortableList.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -42,38 +39,14 @@ License
|
|||||||
template<class Face>
|
template<class Face>
|
||||||
Foam::wordHashSet Foam::UnsortedMeshedSurface<Face>::readTypes()
|
Foam::wordHashSet Foam::UnsortedMeshedSurface<Face>::readTypes()
|
||||||
{
|
{
|
||||||
wordHashSet supported(2*fileExtensionConstructorTablePtr_->size());
|
return wordHashSet(*fileExtensionConstructorTablePtr_);
|
||||||
|
|
||||||
forAllIter
|
|
||||||
(
|
|
||||||
typename fileExtensionConstructorTable::iterator,
|
|
||||||
*fileExtensionConstructorTablePtr_,
|
|
||||||
iter
|
|
||||||
)
|
|
||||||
{
|
|
||||||
supported.insert(iter.key());
|
|
||||||
}
|
|
||||||
|
|
||||||
return supported;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Face>
|
template<class Face>
|
||||||
Foam::wordHashSet Foam::UnsortedMeshedSurface<Face>::writeTypes()
|
Foam::wordHashSet Foam::UnsortedMeshedSurface<Face>::writeTypes()
|
||||||
{
|
{
|
||||||
wordHashSet supported(2*writefileExtensionMemberFunctionTablePtr_->size());
|
return wordHashSet(*writefileExtensionMemberFunctionTablePtr_);
|
||||||
|
|
||||||
forAllIter
|
|
||||||
(
|
|
||||||
typename writefileExtensionMemberFunctionTable::iterator,
|
|
||||||
*writefileExtensionMemberFunctionTablePtr_,
|
|
||||||
iter
|
|
||||||
)
|
|
||||||
{
|
|
||||||
supported.insert(iter.key());
|
|
||||||
}
|
|
||||||
|
|
||||||
return supported;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -89,11 +62,16 @@ bool Foam::UnsortedMeshedSurface<Face>::canReadType
|
|||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
wordHashSet available = readTypes();
|
{
|
||||||
available += SiblingType::readTypes();;
|
return checkSupport
|
||||||
|
(
|
||||||
return checkSupport(available, ext, verbose, "reading");
|
readTypes() | SiblingType::readTypes(),
|
||||||
|
ext,
|
||||||
|
verbose,
|
||||||
|
"reading"
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -139,8 +117,9 @@ void Foam::UnsortedMeshedSurface<Face>::write
|
|||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "UnsortedMeshedSurface::write(const fileName&, const UnsortedMeshedSurface&) : "
|
Info<< "UnsortedMeshedSurface::write"
|
||||||
"writing UnsortedMeshedSurface to " << fName
|
"(const fileName&, const UnsortedMeshedSurface&) : "
|
||||||
|
"writing to " << fName
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -107,6 +107,23 @@ public:
|
|||||||
//- Read from file
|
//- Read from file
|
||||||
virtual bool read(const fileName&);
|
virtual bool read(const fileName&);
|
||||||
|
|
||||||
|
//- Write MeshedSurface
|
||||||
|
static void write
|
||||||
|
(
|
||||||
|
Ostream&,
|
||||||
|
const MeshedSurface<Face>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Write MeshedSurface
|
||||||
|
static void write
|
||||||
|
(
|
||||||
|
const fileName& fName,
|
||||||
|
const MeshedSurface<Face>& surf
|
||||||
|
)
|
||||||
|
{
|
||||||
|
write(OFstream(fName)(), surf);
|
||||||
|
}
|
||||||
|
|
||||||
//- Write UnsortedMeshedSurface
|
//- Write UnsortedMeshedSurface
|
||||||
// The output is always sorted by regions.
|
// The output is always sorted by regions.
|
||||||
static void write
|
static void write
|
||||||
@ -126,23 +143,6 @@ public:
|
|||||||
write(OFstream(fName)(), surf);
|
write(OFstream(fName)(), surf);
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Write MeshedSurface
|
|
||||||
static void write
|
|
||||||
(
|
|
||||||
Ostream&,
|
|
||||||
const MeshedSurface<Face>&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Write MeshedSurface
|
|
||||||
static void write
|
|
||||||
(
|
|
||||||
const fileName& fName,
|
|
||||||
const MeshedSurface<Face>& surf
|
|
||||||
)
|
|
||||||
{
|
|
||||||
write(OFstream(fName)(), surf);
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Write object
|
//- Write object
|
||||||
virtual void write(Ostream& os) const
|
virtual void write(Ostream& os) const
|
||||||
{
|
{
|
||||||
|
|||||||
@ -56,7 +56,7 @@ addNamedTemplatedToRunTimeSelectionTable
|
|||||||
|
|
||||||
addNamedTemplatedToMemberFunctionSelectionTable
|
addNamedTemplatedToMemberFunctionSelectionTable
|
||||||
(
|
(
|
||||||
UnsortedMeshedSurface,
|
MeshedSurface,
|
||||||
AC3DsurfaceFormat,
|
AC3DsurfaceFormat,
|
||||||
face,
|
face,
|
||||||
write,
|
write,
|
||||||
@ -65,7 +65,7 @@ addNamedTemplatedToMemberFunctionSelectionTable
|
|||||||
);
|
);
|
||||||
addNamedTemplatedToMemberFunctionSelectionTable
|
addNamedTemplatedToMemberFunctionSelectionTable
|
||||||
(
|
(
|
||||||
UnsortedMeshedSurface,
|
MeshedSurface,
|
||||||
AC3DsurfaceFormat,
|
AC3DsurfaceFormat,
|
||||||
triFace,
|
triFace,
|
||||||
write,
|
write,
|
||||||
@ -76,7 +76,7 @@ addNamedTemplatedToMemberFunctionSelectionTable
|
|||||||
|
|
||||||
addNamedTemplatedToMemberFunctionSelectionTable
|
addNamedTemplatedToMemberFunctionSelectionTable
|
||||||
(
|
(
|
||||||
MeshedSurface,
|
UnsortedMeshedSurface,
|
||||||
AC3DsurfaceFormat,
|
AC3DsurfaceFormat,
|
||||||
face,
|
face,
|
||||||
write,
|
write,
|
||||||
@ -85,7 +85,7 @@ addNamedTemplatedToMemberFunctionSelectionTable
|
|||||||
);
|
);
|
||||||
addNamedTemplatedToMemberFunctionSelectionTable
|
addNamedTemplatedToMemberFunctionSelectionTable
|
||||||
(
|
(
|
||||||
MeshedSurface,
|
UnsortedMeshedSurface,
|
||||||
AC3DsurfaceFormat,
|
AC3DsurfaceFormat,
|
||||||
triFace,
|
triFace,
|
||||||
write,
|
write,
|
||||||
|
|||||||
@ -95,6 +95,23 @@ public:
|
|||||||
//- Read from file
|
//- Read from file
|
||||||
virtual bool read(const fileName&);
|
virtual bool read(const fileName&);
|
||||||
|
|
||||||
|
//- Write MeshedSurface
|
||||||
|
static void write
|
||||||
|
(
|
||||||
|
Ostream&,
|
||||||
|
const MeshedSurface<Face>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Write MeshedSurface
|
||||||
|
static void write
|
||||||
|
(
|
||||||
|
const fileName& fName,
|
||||||
|
const MeshedSurface<Face>& surf
|
||||||
|
)
|
||||||
|
{
|
||||||
|
write(OFstream(fName)(), surf);
|
||||||
|
}
|
||||||
|
|
||||||
//- Write UnsortedMeshedSurface
|
//- Write UnsortedMeshedSurface
|
||||||
// The output is sorted by regions
|
// The output is sorted by regions
|
||||||
static void write
|
static void write
|
||||||
@ -114,23 +131,6 @@ public:
|
|||||||
write(OFstream(fName)(), surf);
|
write(OFstream(fName)(), surf);
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Write MeshedSurface
|
|
||||||
static void write
|
|
||||||
(
|
|
||||||
Ostream&,
|
|
||||||
const MeshedSurface<Face>&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Write MeshedSurface
|
|
||||||
static void write
|
|
||||||
(
|
|
||||||
const fileName& fName,
|
|
||||||
const MeshedSurface<Face>& surf
|
|
||||||
)
|
|
||||||
{
|
|
||||||
write(OFstream(fName)(), surf);
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Write object
|
//- Write object
|
||||||
virtual void write(Ostream& os) const
|
virtual void write(Ostream& os) const
|
||||||
{
|
{
|
||||||
|
|||||||
@ -55,7 +55,7 @@ addNamedTemplatedToRunTimeSelectionTable
|
|||||||
|
|
||||||
addNamedTemplatedToMemberFunctionSelectionTable
|
addNamedTemplatedToMemberFunctionSelectionTable
|
||||||
(
|
(
|
||||||
UnsortedMeshedSurface,
|
MeshedSurface,
|
||||||
GTSsurfaceFormat,
|
GTSsurfaceFormat,
|
||||||
face,
|
face,
|
||||||
write,
|
write,
|
||||||
@ -64,7 +64,7 @@ addNamedTemplatedToMemberFunctionSelectionTable
|
|||||||
);
|
);
|
||||||
addNamedTemplatedToMemberFunctionSelectionTable
|
addNamedTemplatedToMemberFunctionSelectionTable
|
||||||
(
|
(
|
||||||
UnsortedMeshedSurface,
|
MeshedSurface,
|
||||||
GTSsurfaceFormat,
|
GTSsurfaceFormat,
|
||||||
triFace,
|
triFace,
|
||||||
write,
|
write,
|
||||||
@ -72,10 +72,9 @@ addNamedTemplatedToMemberFunctionSelectionTable
|
|||||||
gts
|
gts
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
addNamedTemplatedToMemberFunctionSelectionTable
|
addNamedTemplatedToMemberFunctionSelectionTable
|
||||||
(
|
(
|
||||||
MeshedSurface,
|
UnsortedMeshedSurface,
|
||||||
GTSsurfaceFormat,
|
GTSsurfaceFormat,
|
||||||
face,
|
face,
|
||||||
write,
|
write,
|
||||||
@ -84,7 +83,7 @@ addNamedTemplatedToMemberFunctionSelectionTable
|
|||||||
);
|
);
|
||||||
addNamedTemplatedToMemberFunctionSelectionTable
|
addNamedTemplatedToMemberFunctionSelectionTable
|
||||||
(
|
(
|
||||||
MeshedSurface,
|
UnsortedMeshedSurface,
|
||||||
GTSsurfaceFormat,
|
GTSsurfaceFormat,
|
||||||
triFace,
|
triFace,
|
||||||
write,
|
write,
|
||||||
|
|||||||
@ -109,6 +109,23 @@ public:
|
|||||||
//- Read from file
|
//- Read from file
|
||||||
virtual bool read(const fileName&);
|
virtual bool read(const fileName&);
|
||||||
|
|
||||||
|
//- Write MeshedSurface
|
||||||
|
static void write
|
||||||
|
(
|
||||||
|
Ostream&,
|
||||||
|
const MeshedSurface<Face>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Write MeshedSurface
|
||||||
|
static void write
|
||||||
|
(
|
||||||
|
const fileName& fName,
|
||||||
|
const MeshedSurface<Face>& surf
|
||||||
|
)
|
||||||
|
{
|
||||||
|
write(OFstream(fName)(), surf);
|
||||||
|
}
|
||||||
|
|
||||||
//- Write UnsortedMeshedSurface
|
//- Write UnsortedMeshedSurface
|
||||||
// The output is sorted by regions
|
// The output is sorted by regions
|
||||||
static void write
|
static void write
|
||||||
@ -128,23 +145,6 @@ public:
|
|||||||
write(OFstream(fName)(), surf);
|
write(OFstream(fName)(), surf);
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Write MeshedSurface
|
|
||||||
static void write
|
|
||||||
(
|
|
||||||
Ostream&,
|
|
||||||
const MeshedSurface<Face>&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Write MeshedSurface
|
|
||||||
static void write
|
|
||||||
(
|
|
||||||
const fileName& fName,
|
|
||||||
const MeshedSurface<Face>& surf
|
|
||||||
)
|
|
||||||
{
|
|
||||||
write(OFstream(fName)(), surf);
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Write object
|
//- Write object
|
||||||
virtual void write(Ostream& os) const
|
virtual void write(Ostream& os) const
|
||||||
{
|
{
|
||||||
|
|||||||
@ -54,6 +54,25 @@ addNamedTemplatedToRunTimeSelectionTable
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
addNamedTemplatedToMemberFunctionSelectionTable
|
||||||
|
(
|
||||||
|
MeshedSurface,
|
||||||
|
OBJsurfaceFormat,
|
||||||
|
face,
|
||||||
|
write,
|
||||||
|
fileExtension,
|
||||||
|
obj
|
||||||
|
);
|
||||||
|
addNamedTemplatedToMemberFunctionSelectionTable
|
||||||
|
(
|
||||||
|
MeshedSurface,
|
||||||
|
OBJsurfaceFormat,
|
||||||
|
triFace,
|
||||||
|
write,
|
||||||
|
fileExtension,
|
||||||
|
obj
|
||||||
|
);
|
||||||
|
|
||||||
addNamedTemplatedToMemberFunctionSelectionTable
|
addNamedTemplatedToMemberFunctionSelectionTable
|
||||||
(
|
(
|
||||||
UnsortedMeshedSurface,
|
UnsortedMeshedSurface,
|
||||||
@ -74,25 +93,6 @@ addNamedTemplatedToMemberFunctionSelectionTable
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
addNamedTemplatedToMemberFunctionSelectionTable
|
|
||||||
(
|
|
||||||
MeshedSurface,
|
|
||||||
OBJsurfaceFormat,
|
|
||||||
face,
|
|
||||||
write,
|
|
||||||
fileExtension,
|
|
||||||
obj
|
|
||||||
);
|
|
||||||
addNamedTemplatedToMemberFunctionSelectionTable
|
|
||||||
(
|
|
||||||
MeshedSurface,
|
|
||||||
OBJsurfaceFormat,
|
|
||||||
triFace,
|
|
||||||
write,
|
|
||||||
fileExtension,
|
|
||||||
obj
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -91,6 +91,23 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
|
//- Write MeshedSurface
|
||||||
|
static void write
|
||||||
|
(
|
||||||
|
Ostream&,
|
||||||
|
const MeshedSurface<Face>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Write MeshedSurface
|
||||||
|
static void write
|
||||||
|
(
|
||||||
|
const fileName& fName,
|
||||||
|
const MeshedSurface<Face>& surf
|
||||||
|
)
|
||||||
|
{
|
||||||
|
write(OFstream(fName)(), surf);
|
||||||
|
}
|
||||||
|
|
||||||
//- Write UnsortedMeshedSurface
|
//- Write UnsortedMeshedSurface
|
||||||
// The output is sorted by region.
|
// The output is sorted by region.
|
||||||
static void write
|
static void write
|
||||||
@ -110,23 +127,6 @@ public:
|
|||||||
write(OFstream(fName)(), surf);
|
write(OFstream(fName)(), surf);
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Write MeshedSurface
|
|
||||||
static void write
|
|
||||||
(
|
|
||||||
Ostream&,
|
|
||||||
const MeshedSurface<Face>&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Write MeshedSurface
|
|
||||||
static void write
|
|
||||||
(
|
|
||||||
const fileName& fName,
|
|
||||||
const MeshedSurface<Face>& surf
|
|
||||||
)
|
|
||||||
{
|
|
||||||
write(OFstream(fName)(), surf);
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Write object
|
//- Write object
|
||||||
virtual void write(Ostream& os) const
|
virtual void write(Ostream& os) const
|
||||||
{
|
{
|
||||||
|
|||||||
@ -38,7 +38,7 @@ namespace fileFormats
|
|||||||
|
|
||||||
addNamedTemplatedToMemberFunctionSelectionTable
|
addNamedTemplatedToMemberFunctionSelectionTable
|
||||||
(
|
(
|
||||||
UnsortedMeshedSurface,
|
MeshedSurface,
|
||||||
SMESHsurfaceFormat,
|
SMESHsurfaceFormat,
|
||||||
face,
|
face,
|
||||||
write,
|
write,
|
||||||
@ -47,7 +47,7 @@ addNamedTemplatedToMemberFunctionSelectionTable
|
|||||||
);
|
);
|
||||||
addNamedTemplatedToMemberFunctionSelectionTable
|
addNamedTemplatedToMemberFunctionSelectionTable
|
||||||
(
|
(
|
||||||
UnsortedMeshedSurface,
|
MeshedSurface,
|
||||||
SMESHsurfaceFormat,
|
SMESHsurfaceFormat,
|
||||||
triFace,
|
triFace,
|
||||||
write,
|
write,
|
||||||
@ -55,10 +55,9 @@ addNamedTemplatedToMemberFunctionSelectionTable
|
|||||||
smesh
|
smesh
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
addNamedTemplatedToMemberFunctionSelectionTable
|
addNamedTemplatedToMemberFunctionSelectionTable
|
||||||
(
|
(
|
||||||
MeshedSurface,
|
UnsortedMeshedSurface,
|
||||||
SMESHsurfaceFormat,
|
SMESHsurfaceFormat,
|
||||||
face,
|
face,
|
||||||
write,
|
write,
|
||||||
@ -67,7 +66,7 @@ addNamedTemplatedToMemberFunctionSelectionTable
|
|||||||
);
|
);
|
||||||
addNamedTemplatedToMemberFunctionSelectionTable
|
addNamedTemplatedToMemberFunctionSelectionTable
|
||||||
(
|
(
|
||||||
MeshedSurface,
|
UnsortedMeshedSurface,
|
||||||
SMESHsurfaceFormat,
|
SMESHsurfaceFormat,
|
||||||
triFace,
|
triFace,
|
||||||
write,
|
write,
|
||||||
|
|||||||
@ -119,6 +119,13 @@ public:
|
|||||||
//- Read from file
|
//- Read from file
|
||||||
virtual bool read(const fileName&);
|
virtual bool read(const fileName&);
|
||||||
|
|
||||||
|
//- Write MeshedSurface
|
||||||
|
static void write
|
||||||
|
(
|
||||||
|
const fileName&,
|
||||||
|
const MeshedSurface<Face>&
|
||||||
|
);
|
||||||
|
|
||||||
//- Write UnsortedMeshedSurface
|
//- Write UnsortedMeshedSurface
|
||||||
// The output is sorted by regions
|
// The output is sorted by regions
|
||||||
static void write
|
static void write
|
||||||
@ -127,13 +134,6 @@ public:
|
|||||||
const UnsortedMeshedSurface<Face>&
|
const UnsortedMeshedSurface<Face>&
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Write MeshedSurface
|
|
||||||
static void write
|
|
||||||
(
|
|
||||||
const fileName&,
|
|
||||||
const MeshedSurface<Face>&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Write to Ostream as one large file - not really useful
|
//- Write to Ostream as one large file - not really useful
|
||||||
virtual void write(Ostream&) const
|
virtual void write(Ostream&) const
|
||||||
{
|
{
|
||||||
|
|||||||
@ -56,7 +56,7 @@ addNamedTemplatedToRunTimeSelectionTable
|
|||||||
|
|
||||||
addNamedTemplatedToMemberFunctionSelectionTable
|
addNamedTemplatedToMemberFunctionSelectionTable
|
||||||
(
|
(
|
||||||
UnsortedMeshedSurface,
|
MeshedSurface,
|
||||||
STARCDsurfaceFormat,
|
STARCDsurfaceFormat,
|
||||||
face,
|
face,
|
||||||
write,
|
write,
|
||||||
@ -65,7 +65,7 @@ addNamedTemplatedToMemberFunctionSelectionTable
|
|||||||
);
|
);
|
||||||
addNamedTemplatedToMemberFunctionSelectionTable
|
addNamedTemplatedToMemberFunctionSelectionTable
|
||||||
(
|
(
|
||||||
UnsortedMeshedSurface,
|
MeshedSurface,
|
||||||
STARCDsurfaceFormat,
|
STARCDsurfaceFormat,
|
||||||
triFace,
|
triFace,
|
||||||
write,
|
write,
|
||||||
@ -76,7 +76,7 @@ addNamedTemplatedToMemberFunctionSelectionTable
|
|||||||
|
|
||||||
addNamedTemplatedToMemberFunctionSelectionTable
|
addNamedTemplatedToMemberFunctionSelectionTable
|
||||||
(
|
(
|
||||||
MeshedSurface,
|
UnsortedMeshedSurface,
|
||||||
STARCDsurfaceFormat,
|
STARCDsurfaceFormat,
|
||||||
face,
|
face,
|
||||||
write,
|
write,
|
||||||
@ -85,7 +85,7 @@ addNamedTemplatedToMemberFunctionSelectionTable
|
|||||||
);
|
);
|
||||||
addNamedTemplatedToMemberFunctionSelectionTable
|
addNamedTemplatedToMemberFunctionSelectionTable
|
||||||
(
|
(
|
||||||
MeshedSurface,
|
UnsortedMeshedSurface,
|
||||||
STARCDsurfaceFormat,
|
STARCDsurfaceFormat,
|
||||||
triFace,
|
triFace,
|
||||||
write,
|
write,
|
||||||
|
|||||||
@ -25,6 +25,7 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "STLsurfaceFormat.H"
|
#include "STLsurfaceFormat.H"
|
||||||
|
#include "ListOps.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -289,35 +290,70 @@ bool Foam::fileFormats::STLsurfaceFormat<Face>::read
|
|||||||
// read in the values
|
// read in the values
|
||||||
STLsurfaceFormatCore reader(fName);
|
STLsurfaceFormatCore reader(fName);
|
||||||
|
|
||||||
// generate the faces:
|
// transfer points
|
||||||
List<Face>& faceLst = this->storedFaces();
|
|
||||||
faceLst.setSize(reader.regions().size());
|
|
||||||
|
|
||||||
// transfer
|
|
||||||
this->storedPoints().transfer(reader.points());
|
this->storedPoints().transfer(reader.points());
|
||||||
this->storedRegions().transfer(reader.regions());
|
|
||||||
|
|
||||||
label ptI = 0;
|
// get the original region information
|
||||||
forAll(faceLst, faceI)
|
List<word> names(xferMove(reader.names()));
|
||||||
|
List<label> unsortedRegions(xferMove(reader.regions()));
|
||||||
|
|
||||||
|
// and determine the sorted order:
|
||||||
|
// avoid SortableList since we discard the main list anyhow
|
||||||
|
List<label> faceMap;
|
||||||
|
sortedOrder(unsortedRegions, faceMap);
|
||||||
|
|
||||||
|
// generate the sorted faces and sorted regions:
|
||||||
|
List<Face> faceLst(faceMap.size());
|
||||||
|
|
||||||
|
DynamicList<label> dynPatchSizes;
|
||||||
|
label prevRegion = -1;
|
||||||
|
label regionSize = 0;
|
||||||
|
|
||||||
|
forAll(faceMap, faceI)
|
||||||
{
|
{
|
||||||
triFace fTri;
|
const label startPt = 3*faceMap[faceI];
|
||||||
|
const label regionI = unsortedRegions[faceMap[faceI]];
|
||||||
|
|
||||||
fTri[0] = ptI++;
|
faceLst[faceI] = triFace(startPt, startPt+1, startPt+2);
|
||||||
fTri[1] = ptI++;
|
|
||||||
fTri[2] = ptI++;
|
|
||||||
|
|
||||||
faceLst[faceI] = fTri;
|
if (prevRegion != regionI)
|
||||||
|
{
|
||||||
|
if (regionSize)
|
||||||
|
{
|
||||||
|
dynPatchSizes.append(regionSize);
|
||||||
|
}
|
||||||
|
prevRegion = regionI;
|
||||||
|
regionSize = 0;
|
||||||
|
}
|
||||||
|
regionSize++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reader.binary())
|
if (regionSize)
|
||||||
{
|
{
|
||||||
this->setPatches(reader.maxRegionId());
|
dynPatchSizes.append(regionSize);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this->setPatches(reader.groupToPatch());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// transfer:
|
||||||
|
this->storedFaces().transfer(faceLst);
|
||||||
|
unsortedRegions.clear();
|
||||||
|
faceMap.clear();
|
||||||
|
|
||||||
|
label start = 0;
|
||||||
|
surfGroupList newPatches(dynPatchSizes.size());
|
||||||
|
forAll(newPatches, patchI)
|
||||||
|
{
|
||||||
|
newPatches[patchI] = surfGroup
|
||||||
|
(
|
||||||
|
names[patchI],
|
||||||
|
dynPatchSizes[patchI],
|
||||||
|
start,
|
||||||
|
patchI
|
||||||
|
);
|
||||||
|
|
||||||
|
start += dynPatchSizes[patchI];
|
||||||
|
}
|
||||||
|
|
||||||
|
this->addPatches(newPatches);
|
||||||
this->stitchFaces(SMALL);
|
this->stitchFaces(SMALL);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,6 +28,10 @@ Class
|
|||||||
Description
|
Description
|
||||||
Provide a means of reading/writing STL files (ASCII and binary).
|
Provide a means of reading/writing STL files (ASCII and binary).
|
||||||
|
|
||||||
|
Note
|
||||||
|
For efficiency, the regions are sorted before creating the faces.
|
||||||
|
The class is thus derived from MeshedSurface.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
STLsurfaceFormat.C
|
STLsurfaceFormat.C
|
||||||
STLsurfaceFormatASCII.L
|
STLsurfaceFormatASCII.L
|
||||||
@ -49,13 +53,13 @@ namespace fileFormats
|
|||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class STLsurfaceFormat Declaration
|
Class STLsurfaceFormat Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
template<class Face>
|
template<class Face>
|
||||||
class STLsurfaceFormat
|
class STLsurfaceFormat
|
||||||
:
|
:
|
||||||
public UnsortedMeshedSurface<Face>
|
public MeshedSurface<Face>
|
||||||
{
|
{
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
@ -106,14 +110,13 @@ public:
|
|||||||
|
|
||||||
// Selectors
|
// Selectors
|
||||||
|
|
||||||
//- Read file and return keyedSurface
|
|
||||||
//- Read file and return surface
|
//- Read file and return surface
|
||||||
static autoPtr<UnsortedMeshedSurface<Face> > New
|
static autoPtr<MeshedSurface<Face> > New
|
||||||
(
|
(
|
||||||
const fileName& fName
|
const fileName& fName
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return autoPtr<UnsortedMeshedSurface<Face> >
|
return autoPtr<MeshedSurface<Face> >
|
||||||
(
|
(
|
||||||
new STLsurfaceFormat<Face>(fName)
|
new STLsurfaceFormat<Face>(fName)
|
||||||
);
|
);
|
||||||
@ -128,13 +131,6 @@ public:
|
|||||||
//- Read from file
|
//- Read from file
|
||||||
virtual bool read(const fileName&);
|
virtual bool read(const fileName&);
|
||||||
|
|
||||||
//- Write UnsortedMeshedSurface (as ASCII) sorted by region
|
|
||||||
static void write
|
|
||||||
(
|
|
||||||
Ostream&,
|
|
||||||
const UnsortedMeshedSurface<Face>&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Write MeshedSurface (as ASCII)
|
//- Write MeshedSurface (as ASCII)
|
||||||
static void write
|
static void write
|
||||||
(
|
(
|
||||||
@ -142,6 +138,20 @@ public:
|
|||||||
const MeshedSurface<Face>&
|
const MeshedSurface<Face>&
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Write MeshedSurface
|
||||||
|
static void write
|
||||||
|
(
|
||||||
|
const fileName&,
|
||||||
|
const MeshedSurface<Face>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Write UnsortedMeshedSurface (as ASCII) sorted by region
|
||||||
|
static void write
|
||||||
|
(
|
||||||
|
Ostream&,
|
||||||
|
const UnsortedMeshedSurface<Face>&
|
||||||
|
);
|
||||||
|
|
||||||
//- Write UnsortedMeshedSurface
|
//- Write UnsortedMeshedSurface
|
||||||
// ASCII output is sorted by region; binary output is unsorted
|
// ASCII output is sorted by region; binary output is unsorted
|
||||||
static void write
|
static void write
|
||||||
@ -150,13 +160,6 @@ public:
|
|||||||
const UnsortedMeshedSurface<Face>&
|
const UnsortedMeshedSurface<Face>&
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Write MeshedSurface
|
|
||||||
static void write
|
|
||||||
(
|
|
||||||
const fileName&,
|
|
||||||
const MeshedSurface<Face>&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Write object (only ASCII output)
|
//- Write object (only ASCII output)
|
||||||
virtual void write(Ostream& os) const
|
virtual void write(Ostream& os) const
|
||||||
{
|
{
|
||||||
|
|||||||
@ -72,14 +72,14 @@ class STLASCIILexer
|
|||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
short groupID_; // current region
|
label groupID_; // current region
|
||||||
short maxGroupID_; // max region
|
|
||||||
label lineNo_;
|
label lineNo_;
|
||||||
word startError_;
|
word startError_;
|
||||||
|
|
||||||
DynamicList<point> points_;
|
DynamicList<point> points_;
|
||||||
DynamicList<label> facets_;
|
DynamicList<label> facets_;
|
||||||
HashTable<label> groupToPatch_;
|
DynamicList<word> names_;
|
||||||
|
HashTable<label> nameIndex_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -110,11 +110,10 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//- region names
|
//- region names
|
||||||
HashTable<label>& groupToPatch()
|
DynamicList<word>& names()
|
||||||
{
|
{
|
||||||
return groupToPatch_;
|
return names_;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -122,7 +121,6 @@ STLASCIILexer::STLASCIILexer(istream* is, const label approxNpoints)
|
|||||||
:
|
:
|
||||||
yyFlexLexer(is),
|
yyFlexLexer(is),
|
||||||
groupID_(-1),
|
groupID_(-1),
|
||||||
maxGroupID_(-1),
|
|
||||||
lineNo_(1),
|
lineNo_(1),
|
||||||
points_(approxNpoints),
|
points_(approxNpoints),
|
||||||
facets_(approxNpoints)
|
facets_(approxNpoints)
|
||||||
@ -237,37 +235,35 @@ endsolid {space}("endsolid"|"ENDSOLID")({some_space}{word})*
|
|||||||
}
|
}
|
||||||
|
|
||||||
<readSolidName>{string} {
|
<readSolidName>{string} {
|
||||||
word group(Foam::string::validate<word>(YYText()));
|
word name(Foam::string::validate<word>(YYText()));
|
||||||
|
|
||||||
HashTable<label>::const_iterator findGroup =
|
HashTable<label>::const_iterator fnd = nameIndex_.find(name);
|
||||||
groupToPatch_.find(group);
|
if (fnd != nameIndex_.end())
|
||||||
|
|
||||||
if (findGroup != groupToPatch_.end())
|
|
||||||
{
|
{
|
||||||
groupID_ = findGroup();
|
groupID_ = fnd();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
groupID_ = ++maxGroupID_;
|
groupID_ = names_.size();
|
||||||
groupToPatch_.insert(group, groupID_);
|
names_.append(name);
|
||||||
|
nameIndex_.insert(name, groupID_);
|
||||||
}
|
}
|
||||||
BEGIN(INITIAL);
|
BEGIN(INITIAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
<readSolidName>{space}\n {
|
<readSolidName>{space}\n {
|
||||||
word group("solid");
|
word name("solid");
|
||||||
|
|
||||||
HashTable<label>::const_iterator findGroup =
|
HashTable<label>::const_iterator fnd = nameIndex_.find(name);
|
||||||
groupToPatch_.find(group);
|
if (fnd != nameIndex_.end())
|
||||||
|
|
||||||
if (findGroup != groupToPatch_.end())
|
|
||||||
{
|
{
|
||||||
groupID_ = findGroup();
|
groupID_ = fnd();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
groupID_ = ++maxGroupID_;
|
groupID_ = names_.size();
|
||||||
groupToPatch_.insert(group, groupID_);
|
names_.append(name);
|
||||||
|
nameIndex_.insert(name, groupID_);
|
||||||
}
|
}
|
||||||
|
|
||||||
lineNo_++;
|
lineNo_++;
|
||||||
@ -394,7 +390,8 @@ bool Foam::fileFormats::STLsurfaceFormatCore::readASCII
|
|||||||
// transfer to normal lists
|
// transfer to normal lists
|
||||||
points_.transfer(lexer.points());
|
points_.transfer(lexer.points());
|
||||||
regions_.transfer(lexer.facets());
|
regions_.transfer(lexer.facets());
|
||||||
groupToPatch_.transfer(lexer.groupToPatch());
|
names_.transfer(lexer.names());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -26,6 +26,7 @@ License
|
|||||||
|
|
||||||
#include "STLsurfaceFormatCore.H"
|
#include "STLsurfaceFormatCore.H"
|
||||||
#include "OSspecific.H"
|
#include "OSspecific.H"
|
||||||
|
#include "Map.H"
|
||||||
|
|
||||||
#undef DEBUG_STLBINARY
|
#undef DEBUG_STLBINARY
|
||||||
|
|
||||||
@ -143,6 +144,9 @@ bool Foam::fileFormats::STLsurfaceFormatCore::readBINARY
|
|||||||
points_.setSize(3*nTris);
|
points_.setSize(3*nTris);
|
||||||
regions_.setSize(nTris);
|
regions_.setSize(nTris);
|
||||||
|
|
||||||
|
Map<label> regionToPatch;
|
||||||
|
DynamicList<word> dynNames;
|
||||||
|
|
||||||
label ptI = 0;
|
label ptI = 0;
|
||||||
forAll(regions_, faceI)
|
forAll(regions_, faceI)
|
||||||
{
|
{
|
||||||
@ -155,20 +159,31 @@ bool Foam::fileFormats::STLsurfaceFormatCore::readBINARY
|
|||||||
points_[ptI++] = stlTri.c();
|
points_[ptI++] = stlTri.c();
|
||||||
|
|
||||||
// interprete colour as a region
|
// interprete colour as a region
|
||||||
regions_[faceI] = stlTri.region();
|
const label stlRegion = stlTri.region();
|
||||||
if (maxRegionId_ < stlTri.region())
|
|
||||||
|
Map<label>::const_iterator fnd = regionToPatch.find(stlRegion);
|
||||||
|
label regionI;
|
||||||
|
if (fnd != regionToPatch.end())
|
||||||
{
|
{
|
||||||
maxRegionId_ = stlTri.region();
|
regionI = fnd();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
regionI = dynNames.size();
|
||||||
|
dynNames.append(word("patch") + ::Foam::name(regionI));
|
||||||
|
regionToPatch.insert(stlRegion, regionI);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
regions_[faceI] = regionI;
|
||||||
|
|
||||||
#ifdef DEBUG_STLBINARY
|
#ifdef DEBUG_STLBINARY
|
||||||
if (prevRegion != stlTri.region())
|
if (prevRegion != regionI)
|
||||||
{
|
{
|
||||||
if (prevRegion != -1)
|
if (prevRegion != -1)
|
||||||
{
|
{
|
||||||
Info<< "endsolid region" << prevRegion << nl;
|
Info<< "endsolid region" << prevRegion << nl;
|
||||||
}
|
}
|
||||||
prevRegion = stlTri.region();
|
prevRegion = regionI;
|
||||||
|
|
||||||
Info<< "solid region" << prevRegion << nl;
|
Info<< "solid region" << prevRegion << nl;
|
||||||
}
|
}
|
||||||
@ -183,6 +198,8 @@ bool Foam::fileFormats::STLsurfaceFormatCore::readBINARY
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
names_.transfer(dynNames);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,8 +214,7 @@ Foam::fileFormats::STLsurfaceFormatCore::STLsurfaceFormatCore
|
|||||||
binary_(false),
|
binary_(false),
|
||||||
points_(0),
|
points_(0),
|
||||||
regions_(0),
|
regions_(0),
|
||||||
maxRegionId_(0),
|
names_(0)
|
||||||
groupToPatch_(0)
|
|
||||||
{
|
{
|
||||||
off_t fileSize = Foam::size(fName);
|
off_t fileSize = Foam::size(fName);
|
||||||
|
|
||||||
@ -228,14 +244,17 @@ void Foam::fileFormats::STLsurfaceFormatCore::writeHeaderBINARY
|
|||||||
unsigned int nTris
|
unsigned int nTris
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Write the STL header, avoid possible trailing junk
|
// STL header with extra information about nTris
|
||||||
string header("STL binary file", headerSize);
|
char header[headerSize];
|
||||||
for (label i = header.size(); i < headerSize; ++i)
|
sprintf(header, "STL binary file %u facets", nTris);
|
||||||
|
|
||||||
|
// avoid trailing junk
|
||||||
|
for (size_t i = strlen(header); i < headerSize; ++i)
|
||||||
{
|
{
|
||||||
header[i] = 0;
|
header[i] = 0;
|
||||||
}
|
}
|
||||||
os.write(header.c_str(), headerSize);
|
|
||||||
|
|
||||||
|
os.write(header, headerSize);
|
||||||
os.write(reinterpret_cast<char*>(&nTris), sizeof(unsigned int));
|
os.write(reinterpret_cast<char*>(&nTris), sizeof(unsigned int));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -67,9 +67,8 @@ class STLsurfaceFormatCore
|
|||||||
//- The regions associated with the faces
|
//- The regions associated with the faces
|
||||||
List<label> regions_;
|
List<label> regions_;
|
||||||
|
|
||||||
label maxRegionId_;
|
//- The solid names, in the order of their first appearance
|
||||||
|
List<word> names_;
|
||||||
HashTable<label> groupToPatch_;
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
@ -93,7 +92,7 @@ public:
|
|||||||
// Static Data
|
// Static Data
|
||||||
|
|
||||||
//- The number of bytes in the STL binary header
|
//- The number of bytes in the STL binary header
|
||||||
static const int headerSize = 80;
|
static const unsigned int headerSize = 80;
|
||||||
|
|
||||||
// Static Member Functions
|
// Static Member Functions
|
||||||
|
|
||||||
@ -128,7 +127,7 @@ public:
|
|||||||
{
|
{
|
||||||
points_.clear();
|
points_.clear();
|
||||||
regions_.clear();
|
regions_.clear();
|
||||||
groupToPatch_.clear();
|
names_.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return full access to the faces
|
//- Return full access to the faces
|
||||||
@ -143,16 +142,10 @@ public:
|
|||||||
return regions_;
|
return regions_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- The max regionId when reading binary files
|
//- The list of solid names in the order of their first appearance
|
||||||
label maxRegionId() const
|
List<word>& names()
|
||||||
{
|
{
|
||||||
return maxRegionId_;
|
return names_;
|
||||||
}
|
|
||||||
|
|
||||||
//- The group/patch information when reading ASCII files
|
|
||||||
const HashTable<label>& groupToPatch() const
|
|
||||||
{
|
|
||||||
return groupToPatch_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -38,7 +38,7 @@ namespace fileFormats
|
|||||||
|
|
||||||
addNamedTemplatedToRunTimeSelectionTable
|
addNamedTemplatedToRunTimeSelectionTable
|
||||||
(
|
(
|
||||||
UnsortedMeshedSurface,
|
MeshedSurface,
|
||||||
STLsurfaceFormat,
|
STLsurfaceFormat,
|
||||||
face,
|
face,
|
||||||
fileExtension,
|
fileExtension,
|
||||||
@ -46,7 +46,7 @@ addNamedTemplatedToRunTimeSelectionTable
|
|||||||
);
|
);
|
||||||
addNamedTemplatedToRunTimeSelectionTable
|
addNamedTemplatedToRunTimeSelectionTable
|
||||||
(
|
(
|
||||||
UnsortedMeshedSurface,
|
MeshedSurface,
|
||||||
STLsurfaceFormat,
|
STLsurfaceFormat,
|
||||||
triFace,
|
triFace,
|
||||||
fileExtension,
|
fileExtension,
|
||||||
@ -55,7 +55,7 @@ addNamedTemplatedToRunTimeSelectionTable
|
|||||||
|
|
||||||
addNamedTemplatedToRunTimeSelectionTable
|
addNamedTemplatedToRunTimeSelectionTable
|
||||||
(
|
(
|
||||||
UnsortedMeshedSurface,
|
MeshedSurface,
|
||||||
STLsurfaceFormat,
|
STLsurfaceFormat,
|
||||||
face,
|
face,
|
||||||
fileExtension,
|
fileExtension,
|
||||||
@ -63,7 +63,7 @@ addNamedTemplatedToRunTimeSelectionTable
|
|||||||
);
|
);
|
||||||
addNamedTemplatedToRunTimeSelectionTable
|
addNamedTemplatedToRunTimeSelectionTable
|
||||||
(
|
(
|
||||||
UnsortedMeshedSurface,
|
MeshedSurface,
|
||||||
STLsurfaceFormat,
|
STLsurfaceFormat,
|
||||||
triFace,
|
triFace,
|
||||||
fileExtension,
|
fileExtension,
|
||||||
@ -71,45 +71,6 @@ addNamedTemplatedToRunTimeSelectionTable
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
addNamedTemplatedToMemberFunctionSelectionTable
|
|
||||||
(
|
|
||||||
UnsortedMeshedSurface,
|
|
||||||
STLsurfaceFormat,
|
|
||||||
face,
|
|
||||||
write,
|
|
||||||
fileExtension,
|
|
||||||
stl
|
|
||||||
);
|
|
||||||
addNamedTemplatedToMemberFunctionSelectionTable
|
|
||||||
(
|
|
||||||
UnsortedMeshedSurface,
|
|
||||||
STLsurfaceFormat,
|
|
||||||
triFace,
|
|
||||||
write,
|
|
||||||
fileExtension,
|
|
||||||
stl
|
|
||||||
);
|
|
||||||
|
|
||||||
addNamedTemplatedToMemberFunctionSelectionTable
|
|
||||||
(
|
|
||||||
UnsortedMeshedSurface,
|
|
||||||
STLsurfaceFormat,
|
|
||||||
face,
|
|
||||||
write,
|
|
||||||
fileExtension,
|
|
||||||
stlb
|
|
||||||
);
|
|
||||||
addNamedTemplatedToMemberFunctionSelectionTable
|
|
||||||
(
|
|
||||||
UnsortedMeshedSurface,
|
|
||||||
STLsurfaceFormat,
|
|
||||||
triFace,
|
|
||||||
write,
|
|
||||||
fileExtension,
|
|
||||||
stlb
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
addNamedTemplatedToMemberFunctionSelectionTable
|
addNamedTemplatedToMemberFunctionSelectionTable
|
||||||
(
|
(
|
||||||
MeshedSurface,
|
MeshedSurface,
|
||||||
@ -148,6 +109,44 @@ addNamedTemplatedToMemberFunctionSelectionTable
|
|||||||
stlb
|
stlb
|
||||||
);
|
);
|
||||||
|
|
||||||
|
addNamedTemplatedToMemberFunctionSelectionTable
|
||||||
|
(
|
||||||
|
UnsortedMeshedSurface,
|
||||||
|
STLsurfaceFormat,
|
||||||
|
face,
|
||||||
|
write,
|
||||||
|
fileExtension,
|
||||||
|
stl
|
||||||
|
);
|
||||||
|
addNamedTemplatedToMemberFunctionSelectionTable
|
||||||
|
(
|
||||||
|
UnsortedMeshedSurface,
|
||||||
|
STLsurfaceFormat,
|
||||||
|
triFace,
|
||||||
|
write,
|
||||||
|
fileExtension,
|
||||||
|
stl
|
||||||
|
);
|
||||||
|
|
||||||
|
addNamedTemplatedToMemberFunctionSelectionTable
|
||||||
|
(
|
||||||
|
UnsortedMeshedSurface,
|
||||||
|
STLsurfaceFormat,
|
||||||
|
face,
|
||||||
|
write,
|
||||||
|
fileExtension,
|
||||||
|
stlb
|
||||||
|
);
|
||||||
|
addNamedTemplatedToMemberFunctionSelectionTable
|
||||||
|
(
|
||||||
|
UnsortedMeshedSurface,
|
||||||
|
STLsurfaceFormat,
|
||||||
|
triFace,
|
||||||
|
write,
|
||||||
|
fileExtension,
|
||||||
|
stlb
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -165,6 +165,7 @@ Foam::fileFormats::surfaceFormatsCore::findMeshName
|
|||||||
return findMeshName(d, meshSubDir);
|
return findMeshName(d, meshSubDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Returns patch info.
|
// Returns patch info.
|
||||||
// Sets faceMap to the indexing according to patch numbers.
|
// Sets faceMap to the indexing according to patch numbers.
|
||||||
// Patch numbers start at 0.
|
// Patch numbers start at 0.
|
||||||
|
|||||||
@ -156,12 +156,11 @@ bool Foam::fileFormats::TRIsurfaceFormat<Face>::read
|
|||||||
word rawName(lineStream);
|
word rawName(lineStream);
|
||||||
word groupName("patch" + rawName(1, rawName.size()-1));
|
word groupName("patch" + rawName(1, rawName.size()-1));
|
||||||
|
|
||||||
HashTable<label>::const_iterator findGroup =
|
HashTable<label>::const_iterator fnd = groupToPatch.find(groupName);
|
||||||
groupToPatch.find(groupName);
|
|
||||||
|
|
||||||
if (findGroup != groupToPatch.end())
|
if (fnd != groupToPatch.end())
|
||||||
{
|
{
|
||||||
groupID = findGroup();
|
groupID = fnd();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -187,7 +186,6 @@ bool Foam::fileFormats::TRIsurfaceFormat<Face>::read
|
|||||||
this->storedPoints().transfer(pointLst);
|
this->storedPoints().transfer(pointLst);
|
||||||
this->storedRegions().transfer(regionLst);
|
this->storedRegions().transfer(regionLst);
|
||||||
|
|
||||||
label ptI = 0;
|
|
||||||
forAll(faceLst, faceI)
|
forAll(faceLst, faceI)
|
||||||
{
|
{
|
||||||
const label startPt = 3 * faceI;
|
const label startPt = 3 * faceI;
|
||||||
|
|||||||
@ -103,6 +103,23 @@ public:
|
|||||||
//- Read from file
|
//- Read from file
|
||||||
virtual bool read(const fileName&);
|
virtual bool read(const fileName&);
|
||||||
|
|
||||||
|
//- Write MeshedSurface
|
||||||
|
static void write
|
||||||
|
(
|
||||||
|
Ostream&,
|
||||||
|
const MeshedSurface<Face>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Write MeshedSurface
|
||||||
|
static void write
|
||||||
|
(
|
||||||
|
const fileName& fName,
|
||||||
|
const MeshedSurface<Face>& surf
|
||||||
|
)
|
||||||
|
{
|
||||||
|
write(OFstream(fName)(), surf);
|
||||||
|
}
|
||||||
|
|
||||||
//- Write UnsortedMeshedSurface
|
//- Write UnsortedMeshedSurface
|
||||||
// By default, the output is not sorted by regions
|
// By default, the output is not sorted by regions
|
||||||
static void write
|
static void write
|
||||||
@ -122,23 +139,6 @@ public:
|
|||||||
write(OFstream(fName)(), surf);
|
write(OFstream(fName)(), surf);
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Write MeshedSurface
|
|
||||||
static void write
|
|
||||||
(
|
|
||||||
Ostream&,
|
|
||||||
const MeshedSurface<Face>&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Write MeshedSurface
|
|
||||||
static void write
|
|
||||||
(
|
|
||||||
const fileName& fName,
|
|
||||||
const MeshedSurface<Face>& surf
|
|
||||||
)
|
|
||||||
{
|
|
||||||
write(OFstream(fName)(), surf);
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Write object
|
//- Write object
|
||||||
// By default, the output is not sorted by regions
|
// By default, the output is not sorted by regions
|
||||||
virtual void write(Ostream& os) const
|
virtual void write(Ostream& os) const
|
||||||
|
|||||||
@ -56,7 +56,7 @@ addNamedTemplatedToRunTimeSelectionTable
|
|||||||
|
|
||||||
addNamedTemplatedToMemberFunctionSelectionTable
|
addNamedTemplatedToMemberFunctionSelectionTable
|
||||||
(
|
(
|
||||||
UnsortedMeshedSurface,
|
MeshedSurface,
|
||||||
TRIsurfaceFormat,
|
TRIsurfaceFormat,
|
||||||
face,
|
face,
|
||||||
write,
|
write,
|
||||||
@ -65,7 +65,7 @@ addNamedTemplatedToMemberFunctionSelectionTable
|
|||||||
);
|
);
|
||||||
addNamedTemplatedToMemberFunctionSelectionTable
|
addNamedTemplatedToMemberFunctionSelectionTable
|
||||||
(
|
(
|
||||||
UnsortedMeshedSurface,
|
MeshedSurface,
|
||||||
TRIsurfaceFormat,
|
TRIsurfaceFormat,
|
||||||
triFace,
|
triFace,
|
||||||
write,
|
write,
|
||||||
@ -73,10 +73,9 @@ addNamedTemplatedToMemberFunctionSelectionTable
|
|||||||
tri
|
tri
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
addNamedTemplatedToMemberFunctionSelectionTable
|
addNamedTemplatedToMemberFunctionSelectionTable
|
||||||
(
|
(
|
||||||
MeshedSurface,
|
UnsortedMeshedSurface,
|
||||||
TRIsurfaceFormat,
|
TRIsurfaceFormat,
|
||||||
face,
|
face,
|
||||||
write,
|
write,
|
||||||
@ -85,7 +84,7 @@ addNamedTemplatedToMemberFunctionSelectionTable
|
|||||||
);
|
);
|
||||||
addNamedTemplatedToMemberFunctionSelectionTable
|
addNamedTemplatedToMemberFunctionSelectionTable
|
||||||
(
|
(
|
||||||
MeshedSurface,
|
UnsortedMeshedSurface,
|
||||||
TRIsurfaceFormat,
|
TRIsurfaceFormat,
|
||||||
triFace,
|
triFace,
|
||||||
write,
|
write,
|
||||||
|
|||||||
@ -88,6 +88,23 @@ public:
|
|||||||
|
|
||||||
// Write
|
// Write
|
||||||
|
|
||||||
|
//- Write MeshedSurface
|
||||||
|
static void write
|
||||||
|
(
|
||||||
|
Ostream&,
|
||||||
|
const MeshedSurface<Face>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Write MeshedSurface
|
||||||
|
static void write
|
||||||
|
(
|
||||||
|
const fileName& fName,
|
||||||
|
const MeshedSurface<Face>& surf
|
||||||
|
)
|
||||||
|
{
|
||||||
|
write(OFstream(fName)(), surf);
|
||||||
|
}
|
||||||
|
|
||||||
//- Write UnsortedMeshedSurface
|
//- Write UnsortedMeshedSurface
|
||||||
// By default, the output is not sorted by regions.
|
// By default, the output is not sorted by regions.
|
||||||
static void write
|
static void write
|
||||||
@ -107,23 +124,6 @@ public:
|
|||||||
write(OFstream(fName)(), surf);
|
write(OFstream(fName)(), surf);
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Write MeshedSurface
|
|
||||||
static void write
|
|
||||||
(
|
|
||||||
Ostream&,
|
|
||||||
const MeshedSurface<Face>&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Write MeshedSurface
|
|
||||||
static void write
|
|
||||||
(
|
|
||||||
const fileName& fName,
|
|
||||||
const MeshedSurface<Face>& surf
|
|
||||||
)
|
|
||||||
{
|
|
||||||
write(OFstream(fName)(), surf);
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Write object
|
//- Write object
|
||||||
virtual void write(Ostream& os) const
|
virtual void write(Ostream& os) const
|
||||||
{
|
{
|
||||||
|
|||||||
@ -36,6 +36,25 @@ namespace Foam
|
|||||||
namespace fileFormats
|
namespace fileFormats
|
||||||
{
|
{
|
||||||
|
|
||||||
|
addNamedTemplatedToMemberFunctionSelectionTable
|
||||||
|
(
|
||||||
|
MeshedSurface,
|
||||||
|
VTKsurfaceFormat,
|
||||||
|
face,
|
||||||
|
write,
|
||||||
|
fileExtension,
|
||||||
|
vtk
|
||||||
|
);
|
||||||
|
addNamedTemplatedToMemberFunctionSelectionTable
|
||||||
|
(
|
||||||
|
MeshedSurface,
|
||||||
|
VTKsurfaceFormat,
|
||||||
|
triFace,
|
||||||
|
write,
|
||||||
|
fileExtension,
|
||||||
|
vtk
|
||||||
|
);
|
||||||
|
|
||||||
addNamedTemplatedToMemberFunctionSelectionTable
|
addNamedTemplatedToMemberFunctionSelectionTable
|
||||||
(
|
(
|
||||||
UnsortedMeshedSurface,
|
UnsortedMeshedSurface,
|
||||||
@ -56,25 +75,6 @@ addNamedTemplatedToMemberFunctionSelectionTable
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
addNamedTemplatedToMemberFunctionSelectionTable
|
|
||||||
(
|
|
||||||
MeshedSurface,
|
|
||||||
VTKsurfaceFormat,
|
|
||||||
face,
|
|
||||||
write,
|
|
||||||
fileExtension,
|
|
||||||
vtk
|
|
||||||
);
|
|
||||||
addNamedTemplatedToMemberFunctionSelectionTable
|
|
||||||
(
|
|
||||||
MeshedSurface,
|
|
||||||
VTKsurfaceFormat,
|
|
||||||
triFace,
|
|
||||||
write,
|
|
||||||
fileExtension,
|
|
||||||
vtk
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user