diff --git a/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C b/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C index aa8b89c033..93d385104f 100644 --- a/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C +++ b/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C @@ -52,10 +52,11 @@ Note #include "timeSelector.H" #include "Time.H" #include "polyMesh.H" -#include "keyedSurface.H" -#include "meshedSurface.H" #include "triSurface.H" +#include "MeshedSurfaces.H" +#include "UnsortedMeshedSurfaces.H" + using namespace Foam; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -69,7 +70,7 @@ int main(int argc, char *argv[]) argList::validOptions.insert("clean", ""); argList::validOptions.insert("scale", "scale"); argList::validOptions.insert("triSurface", ""); - argList::validOptions.insert("keyed", ""); + argList::validOptions.insert("unsorted", ""); # include "setRootCase.H" const stringList& params = args.additionalArgs(); @@ -122,9 +123,9 @@ int main(int argc, char *argv[]) // write sorted by region surf.write(exportName, true); } - else if (args.options().found("keyed")) + else if (args.options().found("unsorted")) { - keyedSurface surf(importName); + unsortedMeshedSurface surf(importName); if (args.options().found("clean")) { diff --git a/src/surfMesh/Make/files b/src/surfMesh/Make/files index def352062d..c7be4a4f32 100644 --- a/src/surfMesh/Make/files +++ b/src/surfMesh/Make/files @@ -2,27 +2,23 @@ surfGroup/surfGroup.C surfGroup/surfGroupIOList.C surfPatchIdentifier/surfPatchIdentifier.C -keyedSurface/keyedSurface.C -keyedSurface/keyedSurfaceCleanup.C -keyedSurface/newKeyedSurface.C +MeshedSurface/MeshedSurfaces.C +UnsortedMeshedSurface/UnsortedMeshedSurfaces.C -meshedSurface/meshedSurface.C -meshedSurface/meshedSurfaceCleanup.C -meshedSurface/newMeshedSurface.C - -fileFormats = keyedSurface/fileFormats -$(fileFormats)/ac3d/AC3DfileFormat.C -$(fileFormats)/ftr/FTRfileFormat.C -$(fileFormats)/gts/GTSfileFormat.C -$(fileFormats)/nas/NASfileFormat.C -$(fileFormats)/obj/OBJfileFormat.C -$(fileFormats)/off/OFFfileFormat.C -$(fileFormats)/smesh/SMESHfileFormat.C -$(fileFormats)/starcd/STARCDfileFormat.C -$(fileFormats)/stl/STLfileFormat.C -$(fileFormats)/stl/STLfileFormatASCII.L -$(fileFormats)/tri/TRIfileFormat.C -$(fileFormats)/vtk/VTKfileFormat.C +surfaceFormats = surfaceFormats +$(surfaceFormats)/ac3d/AC3DsurfaceFormatRunTime.C +$(surfaceFormats)/ftr/FTRsurfaceFormatRunTime.C +$(surfaceFormats)/gts/GTSsurfaceFormatRunTime.C +$(surfaceFormats)/nas/NASsurfaceFormatRunTime.C +$(surfaceFormats)/obj/OBJsurfaceFormatRunTime.C +$(surfaceFormats)/off/OFFsurfaceFormatRunTime.C +$(surfaceFormats)/smesh/SMESHsurfaceFormatRunTime.C +$(surfaceFormats)/starcd/STARCDsurfaceFormatRunTime.C +$(surfaceFormats)/stl/STLsurfaceFormatRunTime.C +$(surfaceFormats)/stl/STLsurfaceFormatASCII.L +$(surfaceFormats)/stl/STLsurfaceFormatCore.C +$(surfaceFormats)/tri/TRIsurfaceFormatRunTime.C +$(surfaceFormats)/vtk/VTKsurfaceFormatRunTime.C LIB = $(FOAM_LIBBIN)/libsurfMesh diff --git a/src/surfMesh/meshedSurface/meshedSurface.C b/src/surfMesh/MeshedSurface/MeshedSurface.C similarity index 67% rename from src/surfMesh/meshedSurface/meshedSurface.C rename to src/surfMesh/MeshedSurface/MeshedSurface.C index 92aa30295f..b7a3a2f5f9 100644 --- a/src/surfMesh/meshedSurface/meshedSurface.C +++ b/src/surfMesh/MeshedSurface/MeshedSurface.C @@ -24,8 +24,8 @@ License \*---------------------------------------------------------------------------*/ -#include "meshedSurface.H" -#include "keyedSurface.H" +#include "MeshedSurface.H" +#include "UnsortedMeshedSurface.H" #include "demandDrivenData.H" #include "IFstream.H" #include "OFstream.H" @@ -41,27 +41,16 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -namespace Foam -{ -defineTypeNameAndDebug(meshedSurface, 0); -defineMemberFunctionSelectionTable -( - meshedSurface, - write, - fileExtension -); -} - -// File extension for 'native' raw format -//! @cond localscope -const char * const nativeExt = "ofs"; -//! @endcond localscope +// File extension for 'native' raw format +#undef nativeSurfaceExt +#define nativeSurfaceExt "ofs" // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // -Foam::fileName Foam::meshedSurface::triSurfInstance(const Time& d) +template +Foam::fileName Foam::MeshedSurface::triSurfInstance(const Time& d) { - fileName foamName(d.caseName() + "." + nativeExt); + fileName foamName(d.caseName() + "." + nativeSurfaceExt); // Search back through the time directories list to find the time // closest to and lower than current time @@ -88,7 +77,7 @@ Foam::fileName Foam::meshedSurface::triSurfInstance(const Time& d) { if (debug) { - Pout<< " meshedSurface::triSurfInstance(const Time& d)" + Pout<< " MeshedSurface::triSurfInstance(const Time& d)" << "reading " << foamName << " from " << ts[j].name()/typeName << endl; @@ -101,7 +90,7 @@ Foam::fileName Foam::meshedSurface::triSurfInstance(const Time& d) if (debug) { - Pout<< " meshedSurface::triSurfInstance(const Time& d)" + Pout<< " MeshedSurface::triSurfInstance(const Time& d)" << "reading " << foamName << " from constant/" << endl; } @@ -110,9 +99,10 @@ Foam::fileName Foam::meshedSurface::triSurfInstance(const Time& d) } -Foam::fileName Foam::meshedSurface::triSurfName(const Time& d) +template +Foam::fileName Foam::MeshedSurface::triSurfName(const Time& d) { - fileName foamName(d.caseName() + "." + nativeExt); + fileName foamName(d.caseName() + "." + nativeSurfaceExt); // Search back through the time directories list to find the time // closest to and lower than current time @@ -141,7 +131,7 @@ Foam::fileName Foam::meshedSurface::triSurfName(const Time& d) { if (debug) { - Pout<< " meshedSurface::triSurfName(const Time& d)" + Pout<< " MeshedSurface::triSurfName(const Time& d)" << "reading " << foamName << " from " << ts[j].name()/typeName << endl; @@ -154,7 +144,7 @@ Foam::fileName Foam::meshedSurface::triSurfName(const Time& d) if (debug) { - Pout<< " meshedSurface::triSurfName(const Time& d)" + Pout<< " MeshedSurface::triSurfName(const Time& d)" << "reading " << foamName << " from constant/" << endl; } @@ -162,13 +152,21 @@ Foam::fileName Foam::meshedSurface::triSurfName(const Time& d) return d.path()/"constant"/typeName/foamName; } -bool Foam::meshedSurface::canRead(const word& ext, const bool verbose) +template +bool Foam::MeshedSurface::canRead(const word& ext, const bool verbose) { - return keyedSurface::canRead(ext, verbose); + // handle 'native' format directly + if (ext == nativeSurfaceExt) + { + return true; + } + + return UnsortedMeshedSurface::canRead(ext, verbose); } -bool Foam::meshedSurface::canWrite(const word& ext, const bool verbose) +template +bool Foam::MeshedSurface::canWrite(const word& ext, const bool verbose) { // perhaps sent an entire name word fExt(ext); @@ -180,12 +178,12 @@ bool Foam::meshedSurface::canWrite(const word& ext, const bool verbose) } // handle 'native' format directly - if (fExt == nativeExt) + if (fExt == nativeSurfaceExt) { return true; } - writefileExtensionMemberFunctionTable::iterator mfIter = + typename writefileExtensionMemberFunctionTable::iterator mfIter = writefileExtensionMemberFunctionTablePtr_->find(fExt); if (mfIter == writefileExtensionMemberFunctionTablePtr_->end()) @@ -199,7 +197,7 @@ bool Foam::meshedSurface::canWrite(const word& ext, const bool verbose) Info<<"Unknown file extension for writing: " << fExt << nl; // compact output: - Info<<"Valid types: ( " << nativeExt; + Info<<"Valid types: ( " << nativeSurfaceExt; forAll(known, i) { Info<<" " << known[i]; @@ -214,63 +212,65 @@ bool Foam::meshedSurface::canWrite(const word& ext, const bool verbose) } -void Foam::meshedSurface::write +template +void Foam::MeshedSurface::write ( const fileName& fName, - const meshedSurface& surf + const MeshedSurface& surf ) { if (debug) { - Info<< "meshedSurface::write(const fileName&, const meshedSurface&) : " - "writing meshedSurface to " << fName + Info<< "MeshedSurface::write(const fileName&, const MeshedSurface&) : " + "writing MeshedSurface to " << fName << endl; } const word ext = fName.ext(); // handle 'native' format directly - if (ext == nativeExt) + if (ext == nativeSurfaceExt) { surf.write(OFstream(fName)()); + return; } - else + + typename writefileExtensionMemberFunctionTable::iterator mfIter = + writefileExtensionMemberFunctionTablePtr_->find(ext); + + if (mfIter == writefileExtensionMemberFunctionTablePtr_->end()) { - writefileExtensionMemberFunctionTable::iterator mfIter = - writefileExtensionMemberFunctionTablePtr_->find(ext); - - if (mfIter == writefileExtensionMemberFunctionTablePtr_->end()) - { - FatalErrorIn - ( - "meshedSurface::write(const fileName&)" - ) << "Unknown file extension " << ext << nl << nl - << "Valid types are :" << endl - << writefileExtensionMemberFunctionTablePtr_->toc() - << exit(FatalError); - } - - mfIter()(fName, surf); + FatalErrorIn + ( + "MeshedSurface::write(const fileName&)" + ) << "Unknown file extension " << ext << nl << nl + << "Valid types are :" << endl + << writefileExtensionMemberFunctionTablePtr_->toc() + << exit(FatalError); } + + mfIter()(fName, surf); } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::meshedSurface::meshedSurface() +template +Foam::MeshedSurface::MeshedSurface() : - MeshStorage(List(), pointField()) + ParentType(List(), pointField()) {} -Foam::meshedSurface::meshedSurface +template +Foam::MeshedSurface::MeshedSurface ( const xfer& pointLst, - const xfer >& faceLst, + const xfer >& faceLst, const xfer& patchLst ) : - MeshStorage(List(), pointField()), + ParentType(List(), pointField()), patches_(patchLst) { points().transfer(pointLst()); @@ -278,16 +278,17 @@ Foam::meshedSurface::meshedSurface } -Foam::meshedSurface::meshedSurface +template +Foam::MeshedSurface::MeshedSurface ( const xfer& pointLst, - const xfer >& faceLst, + const xfer >& faceLst, const UList