diff --git a/src/meshTools/triSurface/triSurfaceLoader/triSurfaceLoader.C b/src/meshTools/triSurface/triSurfaceLoader/triSurfaceLoader.C index d5e6d4d8e7..d40c008776 100644 --- a/src/meshTools/triSurface/triSurfaceLoader/triSurfaceLoader.C +++ b/src/meshTools/triSurface/triSurfaceLoader/triSurfaceLoader.C @@ -28,6 +28,15 @@ License #include "Time.H" #include "OSspecific.H" +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +const Foam::Enum +Foam::triSurfaceLoader::loadingOptionNames +( + SINGLE_REGION, { "single", "file", "offset", "merge" } +); + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::triSurfaceLoader::triSurfaceLoader(const fileName& directory) @@ -201,24 +210,56 @@ Foam::label Foam::triSurfaceLoader::select(const wordReList& matcher) } -Foam::autoPtr Foam::triSurfaceLoader::load() const +Foam::autoPtr Foam::triSurfaceLoader::load +( + const enum loadingOption opt +) const { + autoPtr output; + if (selected_.empty()) { - return autoPtr(); + return output; } else if (selected_.size() == 1) { - return autoPtr(new triSurface(directory_/selected_[0])); + output.set(new triSurface(directory_/selected_[0])); + + triSurface& surf = output(); + + if + ( + opt == loadingOption::SINGLE_REGION + || opt == loadingOption::FILE_REGION + ) + { + for (labelledTri& f : surf) + { + f.region() = 0; + } + + if (surf.patches().size()) + { + surf.patches().setSize(1); + } + else + { + surf.patches().append + ( + geometricSurfacePatch(selected_[0].lessExt(), 0) + ); + } + } + + return output; } + List faces; pointField points; - label regoff = 0; // region offset - // collect all patches, preserving names. - // This will be horrible for output, but is good if we are relying on - // the names for defining baffles. + Map