diff --git a/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C b/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C index c9b5678dfb..a907c7208c 100644 --- a/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C +++ b/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C @@ -93,8 +93,8 @@ int main(int argc, char *argv[]) if ( - !meshedSurface::canRead(importName.ext(), true) - || !meshedSurface::canWrite(exportName.ext(), true) + !meshedSurface::canRead(importName, true) + || !meshedSurface::canWriteType(exportName.ext(), true) ) { return 1; diff --git a/src/surfMesh/MeshedSurface/MeshedSurface.C b/src/surfMesh/MeshedSurface/MeshedSurface.C index 2e528a710e..a7b92cc73a 100644 --- a/src/surfMesh/MeshedSurface/MeshedSurface.C +++ b/src/surfMesh/MeshedSurface/MeshedSurface.C @@ -26,11 +26,9 @@ License #include "MeshedSurface.H" #include "UnsortedMeshedSurface.H" -#include "demandDrivenData.H" #include "IFstream.H" #include "OFstream.H" #include "Time.H" -#include "boundBox.H" #include "SortableList.H" #include "ListOps.H" #include "polyBoundaryMesh.H" @@ -45,14 +43,11 @@ License // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // template -inline bool Foam::MeshedSurface::isTri() -{ - return false; -} - - -template -bool Foam::MeshedSurface::canRead(const word& ext, const bool verbose) +bool Foam::MeshedSurface::canReadType +( + const word& ext, + const bool verbose +) { // handle 'native' format directly if (isNative(ext)) @@ -65,25 +60,20 @@ bool Foam::MeshedSurface::canRead(const word& ext, const bool verbose) template -bool Foam::MeshedSurface::canWrite(const word& ext, const bool verbose) +bool Foam::MeshedSurface::canWriteType +( + const word& ext, + const bool verbose +) { - // perhaps sent an entire name - word fExt(ext); - - string::size_type dot = ext.find_last_of("."); - if (dot != string::npos) - { - fExt = ext.substr(dot+1); - } - // handle 'native' format directly - if (isNative(fExt)) + if (isNative(ext)) { return true; } typename writefileExtensionMemberFunctionTable::iterator mfIter = - writefileExtensionMemberFunctionTablePtr_->find(fExt); + writefileExtensionMemberFunctionTablePtr_->find(ext); if (mfIter == writefileExtensionMemberFunctionTablePtr_->end()) { @@ -94,7 +84,7 @@ bool Foam::MeshedSurface::canWrite(const word& ext, const bool verbose) writefileExtensionMemberFunctionTablePtr_->toc() ); - Info<<"Unknown file extension for writing: " << fExt << nl; + Info<<"Unknown file extension for writing: " << ext << nl; // compact output: Info<<"Valid types: ( " << nativeExt; forAll(known, i) @@ -111,6 +101,22 @@ bool Foam::MeshedSurface::canWrite(const word& ext, const bool verbose) } +template +bool Foam::MeshedSurface::canRead +( + const fileName& fName, + const bool verbose +) +{ + word ext = fName.ext(); + if (ext == "gz") + { + ext = fName.lessExt().ext(); + } + return canReadType(ext, verbose); +} + + template void Foam::MeshedSurface::write ( @@ -125,7 +131,7 @@ void Foam::MeshedSurface::write << endl; } - const word ext = fName.ext(); + word ext = fName.ext(); // handle 'native' format directly if (isNative(ext)) @@ -156,8 +162,6 @@ void Foam::MeshedSurface::write template Foam::MeshedSurface::MeshedSurface() -: - ParentType(List(), pointField()) {} @@ -169,12 +173,9 @@ Foam::MeshedSurface::MeshedSurface const xfer& patchLst ) : - ParentType(List(), pointField()), + ParentType(pointLst, faceLst), patches_(patchLst) -{ - storedPoints().transfer(pointLst()); - storedFaces().transfer(faceLst()); -} +{} template @@ -187,11 +188,8 @@ Foam::MeshedSurface::MeshedSurface const UList& patchTypes ) : - ParentType(List(), pointField()) + ParentType(pointLst, faceLst) { - storedPoints().transfer(pointLst()); - storedFaces().transfer(faceLst()); - surfGroupList newPatches(patchSizes.size()); label start = 0; @@ -221,17 +219,9 @@ Foam::MeshedSurface::MeshedSurface const Map& regionNames ) : - ParentType(List(), pointField()) + ParentType(pointLst, faceLst) { - storedPoints().transfer(pointLst()); - storedFaces().transfer(faceLst()); - - if - ( - ®ionIds - && regionIds.size() != 0 - && regionIds.size() != nFaces() - ) + if (®ionIds && regionIds.size() && regionIds.size() != size()) { FatalErrorIn ( @@ -243,7 +233,7 @@ Foam::MeshedSurface::MeshedSurface " const Map& regionNames\n" " )\n" ) - << "size mismatch : regionIds.size() != nFaces()" + << "size mismatch : region and face sizes" << exit(FatalError); } else @@ -262,12 +252,9 @@ Foam::MeshedSurface::MeshedSurface const HashTable