diff --git a/src/surfMesh/MeshedSurface/MeshedSurface.C b/src/surfMesh/MeshedSurface/MeshedSurface.C index 0606860e64..41d0418a3b 100644 --- a/src/surfMesh/MeshedSurface/MeshedSurface.C +++ b/src/surfMesh/MeshedSurface/MeshedSurface.C @@ -33,24 +33,17 @@ License #include "polyMesh.H" #include "surfMesh.H" #include "primitivePatch.H" +#include "faceTraits.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -template -inline bool Foam::MeshedSurface::isTri() -{ - return false; -} - - template Foam::wordHashSet Foam::MeshedSurface::readTypes() { return wordHashSet(*fileExtensionConstructorTablePtr_); } - template Foam::wordHashSet Foam::MeshedSurface::writeTypes() { @@ -116,25 +109,34 @@ void Foam::MeshedSurface::write const fileName& name, const MeshedSurface& surf ) +{ + write(name, name.ext(), surf); +} + + +template +void Foam::MeshedSurface::write +( + const fileName& name, + const word& ext, + const MeshedSurface& surf +) { if (debug) { InfoInFunction << "Writing to " << name << endl; } - const word ext = name.ext(); + auto mfIter = writefileExtensionMemberFunctionTablePtr_->find(ext); - typename writefileExtensionMemberFunctionTable::iterator mfIter = - writefileExtensionMemberFunctionTablePtr_->find(ext); - - if (mfIter == writefileExtensionMemberFunctionTablePtr_->end()) + if (!mfIter.found()) { // No direct writer, delegate to proxy if possible const wordHashSet& delegate = ProxyType::writeTypes(); if (delegate.found(ext)) { - MeshedSurfaceProxy(surf).write(name); + MeshedSurfaceProxy(surf).write(name, ext); } else { @@ -850,6 +852,11 @@ bool Foam::MeshedSurface::checkFaces template Foam::label Foam::MeshedSurface::nTriangles() const { + if (faceTraits::isTri()) + { + return ParentType::size(); + } + return nTriangles ( const_cast&>(List