diff --git a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C index f4a01a7f89d96778b6becb82aa52855623755061..14b3ca71eb37cd90890403768bf931d58bf18977 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -785,7 +785,7 @@ int main(int argc, char *argv[]) if (flipNormals) { Info<< "Flipping faces." << nl << endl; - faceList& faces = const_cast<faceList&>(fMesh.faces()); + faceList& faces = const_cast<faceList&>(fMesh.surfFaces()); forAll(faces, i) { faces[i] = fMesh[i].reverseFace(); diff --git a/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/patchToPoly2DMesh/patchToPoly2DMesh.C b/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/patchToPoly2DMesh/patchToPoly2DMesh.C index 15bc659154e8dee2103ba6f351c44befcadeee46..20ebc345168de757765ab8f15f3856e082a04edc 100644 --- a/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/patchToPoly2DMesh/patchToPoly2DMesh.C +++ b/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/patchToPoly2DMesh/patchToPoly2DMesh.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -172,7 +172,7 @@ void Foam::patchToPoly2DMesh::addPatchFacesToFaces() void Foam::patchToPoly2DMesh::addPatchFacesToOwner() { const label nInternalEdges = patch_.nInternalEdges(); - const faceList& faces = patch_.faces(); + const faceList& faces = patch_.surfFaces(); const label nExternalEdges = patch_.edges().size() - nInternalEdges; const labelList& meshPoints = patch_.meshPoints(); diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/automatic/automatic.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/automatic/automatic.C index 025ba5885d9cc0cc051b650996ee57b2ddc3b6ad..9b69ae120e1234a2170a23ab638d88a1e39f9c26 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/automatic/automatic.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/automatic/automatic.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -289,8 +289,11 @@ Foam::tmp<Foam::triSurfacePointScalarField> Foam::automatic::load() ( surface_.searchableSurface::time().constant()/"triSurface", surfaceName_.lessExt().name(), - surface_.points(), - faces, + meshedSurfRef + ( + surface_.points(), + faces + ), "cellSize", pointCellSize, true, diff --git a/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/shortEdgeFilter2D.C b/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/shortEdgeFilter2D.C index fc2c048d7d1c027c24457fe8e99bbba6c1d9a6f2..0e8d4963a5697df780c83482c13622ae2fc97c48 100644 --- a/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/shortEdgeFilter2D.C +++ b/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/shortEdgeFilter2D.C @@ -232,7 +232,7 @@ Foam::shortEdgeFilter2D::filter() // These are global indices. const pointField& points = ms_.points(); const edgeList& edges = ms_.edges(); - const faceList& faces = ms_.faces(); + const faceList& faces = ms_.surfFaces(); const labelList& meshPoints = ms_.meshPoints(); const labelList& boundaryPoints = ms_.boundaryPoints(); diff --git a/applications/utilities/mesh/manipulation/checkMesh/Make/options b/applications/utilities/mesh/manipulation/checkMesh/Make/options index 0653767f3e68f60836c1dae1f8e304fc0034ec53..5d3dac934f252f42f27253552d7492fe1e4db6dc 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/Make/options +++ b/applications/utilities/mesh/manipulation/checkMesh/Make/options @@ -9,5 +9,4 @@ EXE_INC = \ EXE_LIBS = \ -lmeshTools \ -lsampling \ - -lsurfMesh \ -ldynamicMesh diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C b/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C index 220e8275f9aee4086832473c60750ec5b3b286d3..b2b265cc05075b0346118ade70d6cf75b69f0b08 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C +++ b/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C @@ -1019,8 +1019,11 @@ Foam::label Foam::checkGeometry ( "postProcessing", "src_" + tmName, - mergedPoints, - mergedFaces, + meshedSurfRef + ( + mergedPoints, + mergedFaces + ), "weightsSum", mergedWeights, false @@ -1066,8 +1069,11 @@ Foam::label Foam::checkGeometry ( "postProcessing", "tgt_" + tmName, - mergedPoints, - mergedFaces, + meshedSurfRef + ( + mergedPoints, + mergedFaces + ), "weightsSum", mergedWeights, false diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkTools.C b/applications/utilities/mesh/manipulation/checkMesh/checkTools.C index 00afbde48972f4d7fed431c1c4c394a138ee2e3a..a26d98912371bd25efd022aa2a728e724d8b24d6 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/checkTools.C +++ b/applications/utilities/mesh/manipulation/checkMesh/checkTools.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -42,6 +42,7 @@ License #include "globalIndex.H" #include "PatchTools.H" +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // void Foam::printMeshStats(const polyMesh& mesh, const bool allTopology) { @@ -238,7 +239,16 @@ void Foam::mergeAndWrite // Write if (Pstream::master()) { - writer.write(outputDir, name, mergedPoints, mergedFaces); + writer.write + ( + outputDir, + name, + meshedSurfRef + ( + mergedPoints, + mergedFaces + ) + ); } } else @@ -247,8 +257,11 @@ void Foam::mergeAndWrite ( outputDir, name, - setPatch.localPoints(), - setPatch.localFaces() + meshedSurfRef + ( + setPatch.localPoints(), + setPatch.localFaces() + ) ); } } diff --git a/applications/utilities/mesh/manipulation/moveDynamicMesh/Make/options b/applications/utilities/mesh/manipulation/moveDynamicMesh/Make/options index f7e149613f4faae128e4ad776740c45a075fba02..79021d1a46c1b4819b0786bdc977afc390c48380 100644 --- a/applications/utilities/mesh/manipulation/moveDynamicMesh/Make/options +++ b/applications/utilities/mesh/manipulation/moveDynamicMesh/Make/options @@ -2,6 +2,7 @@ EXE_INC = \ -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/surfMesh/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude EXE_LIBS = \ diff --git a/applications/utilities/mesh/manipulation/moveDynamicMesh/moveDynamicMesh.C b/applications/utilities/mesh/manipulation/moveDynamicMesh/moveDynamicMesh.C index b5f74359bcc1a0d484952bb34e8099b25ae05a39..477d4cbafc621461ed260dc23e3313e4d7d331a6 100644 --- a/applications/utilities/mesh/manipulation/moveDynamicMesh/moveDynamicMesh.C +++ b/applications/utilities/mesh/manipulation/moveDynamicMesh/moveDynamicMesh.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -95,8 +95,11 @@ void writeWeights ( directory, prefix + "_" + timeName, - mergedPoints, - mergedFaces, + meshedSurfRef + ( + mergedPoints, + mergedFaces + ), "weightsSum", mergedWeights, false diff --git a/applications/utilities/surface/surfaceCheck/Make/options b/applications/utilities/surface/surfaceCheck/Make/options index ef204ab685abd76efe285c169f1597226b475441..28fb9f2ccebe4e9e245cb1c66ea6e677d567751c 100644 --- a/applications/utilities/surface/surfaceCheck/Make/options +++ b/applications/utilities/surface/surfaceCheck/Make/options @@ -7,5 +7,4 @@ EXE_INC = \ EXE_LIBS = \ -lsampling \ -ltriSurface \ - -lsurfMesh \ -lmeshTools diff --git a/applications/utilities/surface/surfaceCheck/surfaceCheck.C b/applications/utilities/surface/surfaceCheck/surfaceCheck.C index baa0617eeb052b62287f6e08a6daf6f7449baba1..dcbf38b8708f2a5f0e2bfbba09ffe56fff32a94f 100644 --- a/applications/utilities/surface/surfaceCheck/surfaceCheck.C +++ b/applications/utilities/surface/surfaceCheck/surfaceCheck.C @@ -228,8 +228,11 @@ void writeZoning ( surfFilePath, surfFileNameBase, - surf.points(), - faces, + meshedSurfRef + ( + surf.points(), + faces + ), fieldName, scalarFaceZone, false // face based data diff --git a/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C b/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C index 3b0a9bdebde742f08251590f6be6947b145f0510..86bfe9a22e7c0b4df8f6dd05ed965be854d73454 100644 --- a/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C +++ b/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -1643,8 +1643,11 @@ int main(int argc, char *argv[]) ( runTime.constantPath()/"triSurface",// outputDir sFeatFileName, // surfaceName - surf.points(), - faces, + meshedSurfRef + ( + surf.points(), + faces + ), "internalCloseness", // fieldName internalCloseness, false, // isNodeValues @@ -1655,8 +1658,11 @@ int main(int argc, char *argv[]) ( runTime.constantPath()/"triSurface",// outputDir sFeatFileName, // surfaceName - surf.points(), - faces, + meshedSurfRef + ( + surf.points(), + faces + ), "externalCloseness", // fieldName externalCloseness, false, // isNodeValues @@ -1691,8 +1697,11 @@ int main(int argc, char *argv[]) ( runTime.constantPath()/"triSurface",// outputDir sFeatFileName, // surfaceName - surf.points(), - faces, + meshedSurfRef + ( + surf.points(), + faces + ), "curvature", // fieldName k, true, // isNodeValues @@ -1769,8 +1778,11 @@ int main(int argc, char *argv[]) ( runTime.constantPath()/"triSurface",// outputDir sFeatFileName, // surfaceName - surf.points(), - faces, + meshedSurfRef + ( + surf.points(), + faces + ), "featureProximity", // fieldName featureProximity, false, // isNodeValues diff --git a/src/edgeMesh/Make/options b/src/edgeMesh/Make/options index 61439e40e2654c4db581a973662a613ec0624b8f..d488d6522e5113c40833de9767808d3422723db5 100644 --- a/src/edgeMesh/Make/options +++ b/src/edgeMesh/Make/options @@ -7,5 +7,4 @@ EXE_INC = \ LIB_LIBS = \ -ltriSurface \ -lmeshTools \ - -lfileFormats \ -lsurfMesh diff --git a/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValueTemplates.C b/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValueTemplates.C index 68158b58ffd05dd97593c18a8d293e7087908a87..5272714d95781c3a10710c061248aafafd0b44bc 100644 --- a/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValueTemplates.C +++ b/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValueTemplates.C @@ -328,8 +328,11 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::writeValues ( outputDir(), regionTypeNames_[regionType_] + ("_" + regionName_), - points, - faces, + meshedSurfRef + ( + points, + faces + ), fieldName, allValues, false diff --git a/src/lagrangian/intermediate/Make/options b/src/lagrangian/intermediate/Make/options index dc893c1148def8bdc4d1b3388691a6ed4cb48a56..a94e947f6790a21592b4ada355306eac76d41b95 100644 --- a/src/lagrangian/intermediate/Make/options +++ b/src/lagrangian/intermediate/Make/options @@ -17,6 +17,7 @@ EXE_INC = \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/surfMesh/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.C index adc6a30ca10d9677b8a96c69f28919cfd74a02a0..2d2ac4d45a85801f051e725bc6ddcf38d730cb2e 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.C +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -204,8 +204,7 @@ void Foam::FacePostProcessing<CloudType>::write() ( this->writeTimeDir(), fZone.name(), - allPoints, - allFaces, + meshedSurfRef(allPoints, allFaces), "massTotal", zoneMassTotal[zoneI], false @@ -215,8 +214,7 @@ void Foam::FacePostProcessing<CloudType>::write() ( this->writeTimeDir(), fZone.name(), - allPoints, - allFaces, + meshedSurfRef(allPoints, allFaces), "massFlowRate", zoneMassFlowRate[zoneI], false diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.C index ffa42aaf4ed88a9aebf89cf659a5ca6490f51593..8ea2b51386d3a29d1ed8d49fa4306889ddccc761 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.C +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -409,10 +409,10 @@ void Foam::ParticleCollector<CloudType>::write() Info<< type() << " output:" << nl; - Field<scalar> faceMassTotal(mass_.size(), 0.0); + Field<scalar> faceMassTotal(mass_.size(), Zero); this->getModelProperty("massTotal", faceMassTotal); - Field<scalar> faceMassFlowRate(massFlowRate_.size(), 0.0); + Field<scalar> faceMassFlowRate(massFlowRate_.size(), Zero); this->getModelProperty("massFlowRate", faceMassFlowRate); @@ -467,8 +467,7 @@ void Foam::ParticleCollector<CloudType>::write() ( this->writeTimeDir(), "collector", - points_, - faces_, + meshedSurfRef(points_, faces_), "massTotal", faceMassTotal, false @@ -478,8 +477,7 @@ void Foam::ParticleCollector<CloudType>::write() ( this->writeTimeDir(), "collector", - points_, - faces_, + meshedSurfRef(points_, faces_), "massFlowRate", faceMassFlowRate, false @@ -490,7 +488,7 @@ void Foam::ParticleCollector<CloudType>::write() if (resetOnWrite_) { - Field<scalar> dummy(faceMassTotal.size(), 0.0); + Field<scalar> dummy(faceMassTotal.size(), Zero); this->setModelProperty("massTotal", dummy); this->setModelProperty("massFlowRate", dummy); diff --git a/src/lagrangian/spray/Make/options b/src/lagrangian/spray/Make/options index b45129b83860fd9cc2c03834908a61ae5b55e1c6..34e92f4b47f08c643ecc8f3ce0fbcbc75208f6c0 100644 --- a/src/lagrangian/spray/Make/options +++ b/src/lagrangian/spray/Make/options @@ -22,6 +22,7 @@ EXE_INC = \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/surfMesh/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude diff --git a/src/mesh/snappyHexMesh/Make/options b/src/mesh/snappyHexMesh/Make/options index 88577d6c825c3afabd897d9744e2fd8a43f8b621..42f1b1d19f93c5f28deb5eccfe2a9f8e52840185 100644 --- a/src/mesh/snappyHexMesh/Make/options +++ b/src/mesh/snappyHexMesh/Make/options @@ -14,7 +14,6 @@ LIB_LIBS = \ -lfiniteVolume \ -llagrangian \ -lmeshTools \ - -lfileFormats \ -ledgeMesh \ -lsurfMesh \ -ltriSurface \ diff --git a/src/meshTools/Make/options b/src/meshTools/Make/options index 1713152e9e502c6789d21eefb44ffd4904e08f91..98853e61fbbda0f1c48b945d89a0b56ee9e2c939 100644 --- a/src/meshTools/Make/options +++ b/src/meshTools/Make/options @@ -5,5 +5,4 @@ EXE_INC = \ LIB_LIBS = \ -ltriSurface \ - -lsurfMesh \ - -lfileFormats + -lsurfMesh diff --git a/src/randomProcesses/Make/options b/src/randomProcesses/Make/options index e1eddd51d2e71217d6f2143c9258a3d396d4f7ea..4d1c505daed6c9e5189349b734e2965e25eb785b 100644 --- a/src/randomProcesses/Make/options +++ b/src/randomProcesses/Make/options @@ -7,5 +7,4 @@ EXE_INC = \ LIB_LIBS = \ -L$(FFTW_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH) -lfftw3 \ -lfiniteVolume \ - -lsampling \ - -lsurfMesh + -lsampling diff --git a/src/randomProcesses/noise/noiseModels/surfaceNoise/surfaceNoise.C b/src/randomProcesses/noise/noiseModels/surfaceNoise/surfaceNoise.C index 2237bdf98e2724882e16d9fdb8a4fff062f0ecd4..f24289c49573d6c7f861c487463197a0f4194f1a 100644 --- a/src/randomProcesses/noise/noiseModels/surfaceNoise/surfaceNoise.C +++ b/src/randomProcesses/noise/noiseModels/surfaceNoise/surfaceNoise.C @@ -290,12 +290,16 @@ Foam::scalar surfaceNoise::writeSurfaceData } } + // could also have meshedSurface implement meshedSurf fileName outFileName = writerPtr_->write ( outDir, fName, - surf.points(), - surf.faces(), + meshedSurfRef + ( + surf.points(), + surf.surfFaces() + ), title, allData, false @@ -313,12 +317,16 @@ Foam::scalar surfaceNoise::writeSurfaceData { const meshedSurface& surf = readerPtr_->geometry(); + // could also have meshedSurface implement meshedSurf writerPtr_->write ( outDir, fName, - surf.points(), - surf.faces(), + meshedSurfRef + ( + surf.points(), + surf.surfFaces() + ), title, data, false diff --git a/src/sampling/Make/options b/src/sampling/Make/options index 0cf5b268b66ff3328432eae842b61c2b1bc557a5..00d418481bcf4eefeb539353f61b60f620b25f58 100644 --- a/src/sampling/Make/options +++ b/src/sampling/Make/options @@ -13,7 +13,6 @@ LIB_LIBS = \ -lfiniteVolume \ -lmeshTools \ -lsurfMesh \ - -lfileFormats \ -ltriSurface \ -llagrangian \ -ldynamicMesh \ diff --git a/src/sampling/sampledSurface/distanceSurface/distanceSurface.H b/src/sampling/sampledSurface/distanceSurface/distanceSurface.H index 407e8914dbafd0a1c961041c115a26e0ceb4ece4..0ca56d080836fce03694b002a1d396c0e1ce47c3 100644 --- a/src/sampling/sampledSurface/distanceSurface/distanceSurface.H +++ b/src/sampling/sampledSurface/distanceSurface/distanceSurface.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -193,6 +193,12 @@ public: return facesPtr_; } + //- Const access to per-face zone/region information + virtual const labelList& zoneIds() const + { + return Foam::emptyLabelList; + } + //- Face area vectors virtual const vectorField& Sf() const { @@ -212,6 +218,7 @@ public: } + //- The underlying surface const triSurface& surface() const { if (cell_) diff --git a/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.H b/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.H index 19efe340b74e93e7da7b7835c638b82c1cdbc5c9..8be9053eea667b28ebee2c3aac1922667ad3717c 100644 --- a/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.H +++ b/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -199,6 +199,12 @@ public: return facesPtr_; } + //- Const access to per-face zone/region information + virtual const labelList& zoneIds() const + { + return Foam::emptyLabelList; + } + //- Face area magnitudes virtual const vectorField& Sf() const { diff --git a/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceCell.H b/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceCell.H index f7a267aa9db38555b92823c4db7f7dd112055c5e..4d0952b2e65b05d69b9104ad19999a9dec7dcc7b 100644 --- a/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceCell.H +++ b/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceCell.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -168,6 +168,12 @@ public: return facesPtr_; } + //- Const access to per-face zone/region information + virtual const labelList& zoneIds() const + { + return Foam::emptyLabelList; + } + //- Face area magnitudes virtual const vectorField& Sf() const { diff --git a/src/sampling/sampledSurface/readers/ensight/ensightSurfaceReader.C b/src/sampling/sampledSurface/readers/ensight/ensightSurfaceReader.C index 16390847143593e0665b2094b4b79a385974083b..bd026f2b91e68eafa22e34441bcc74c8a9f6e84a 100644 --- a/src/sampling/sampledSurface/readers/ensight/ensightSurfaceReader.C +++ b/src/sampling/sampledSurface/readers/ensight/ensightSurfaceReader.C @@ -333,7 +333,7 @@ const Foam::meshedSurface& Foam::ensightSurfaceReader::geometry() Info<< "binary" << endl; } } - + ensightReadFile is(baseDir_/meshFileName_, streamFormat_); @@ -343,7 +343,7 @@ const Foam::meshedSurface& Foam::ensightSurfaceReader::geometry() } readGeometryHeader(is); - + label nPoints; is.read(nPoints); diff --git a/src/sampling/sampledSurface/readers/ensight/ensightSurfaceReaderTemplates.C b/src/sampling/sampledSurface/readers/ensight/ensightSurfaceReaderTemplates.C index dace0703200ddf109ead4409c642943feef53db2..5b8b3f555921e9e19fcede384aaa7c169a06c6ac 100644 --- a/src/sampling/sampledSurface/readers/ensight/ensightSurfaceReaderTemplates.C +++ b/src/sampling/sampledSurface/readers/ensight/ensightSurfaceReaderTemplates.C @@ -88,7 +88,7 @@ Foam::tmp<Foam::Field<Type> > Foam::ensightSurfaceReader::readField const word indexStr = oss.str(); fieldFileName.replace(maskStr, indexStr); - + ensightReadFile is(baseDir_/fieldFileName, streamFormat_); if (!is.good()) @@ -102,7 +102,7 @@ Foam::tmp<Foam::Field<Type> > Foam::ensightSurfaceReader::readField // Check that data type is as expected string primitiveType; is.read(primitiveType); - + if (debug) { diff --git a/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.H b/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.H index c4fb497767c36a6ed99cfe857bbbef375c4aaa35..6af60649219ac9a301034f507405bd5be3bb1d04 100644 --- a/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.H +++ b/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -182,6 +182,12 @@ public: return facesPtr_; } + //- Const access to per-face zone/region information + virtual const labelList& zoneIds() const + { + return Foam::emptyLabelList; + } + //- Face area magnitudes virtual const vectorField& Sf() const { diff --git a/src/sampling/sampledSurface/sampledPatch/sampledPatch.H b/src/sampling/sampledSurface/sampledPatch/sampledPatch.H index e47d7494ba194528c47865f0202f7c47e9b1167b..76800d8c62d59ab2dda5b5016d1b6141065492e3 100644 --- a/src/sampling/sampledSurface/sampledPatch/sampledPatch.H +++ b/src/sampling/sampledSurface/sampledPatch/sampledPatch.H @@ -177,7 +177,13 @@ public: //- Faces of surface virtual const faceList& faces() const { - return MeshStorage::faces(); + return MeshStorage::surfFaces(); + } + + //- Const access to per-face zone/region information + virtual const labelList& zoneIds() const + { + return Foam::emptyLabelList; } //- Face area vectors diff --git a/src/sampling/sampledSurface/sampledPlane/sampledPlane.H b/src/sampling/sampledSurface/sampledPlane/sampledPlane.H index 6269d39d9a69c605f603c920c46d82ddfb632b32..4171cb3e36b27604b1b2979146573566ed7f72ba 100644 --- a/src/sampling/sampledSurface/sampledPlane/sampledPlane.H +++ b/src/sampling/sampledSurface/sampledPlane/sampledPlane.H @@ -137,7 +137,14 @@ public: //- Faces of surface virtual const faceList& faces() const { - return cuttingPlane::faces(); + return cuttingPlane::surfFaces(); + } + + //- Const access to per-face zone/region information + // Could instead return meshCells or cellZoneId of the meshCells. + virtual const labelList& zoneIds() const + { + return Foam::emptyLabelList; } //- Face area magnitudes diff --git a/src/sampling/sampledSurface/sampledSurface/sampledSurface.H b/src/sampling/sampledSurface/sampledSurface/sampledSurface.H index 3ddf4c29804166b6aa8d141edf21f803d27c1056..b625675eff24ab7e28d232ba254fd7b64ab15056 100644 --- a/src/sampling/sampledSurface/sampledSurface/sampledSurface.H +++ b/src/sampling/sampledSurface/sampledSurface/sampledSurface.H @@ -52,7 +52,7 @@ SourceFiles #ifndef sampledSurface_H #define sampledSurface_H -#include "pointField.H" +#include "meshedSurf.H" #include "word.H" #include "labelList.H" #include "faceList.H" @@ -83,6 +83,8 @@ Ostream& operator<<(Ostream&, const sampledSurface&); \*---------------------------------------------------------------------------*/ class sampledSurface +: + public meshedSurf { // Private data diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C index 88eb52b09194a2fc4cb858e5d0f710b02218000f..f15c61b36315f0d3bd89dcdb14334c7bbc6d7e70 100644 --- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C +++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C @@ -66,26 +66,19 @@ void Foam::sampledSurfaces::writeGeometry() const if (Pstream::parRun()) { - if (Pstream::master() && mergeList_[surfI].faces.size()) + if (Pstream::master() && mergedList_[surfI].size()) { formatter_->write ( outputDir, s.name(), - mergeList_[surfI].points, - mergeList_[surfI].faces + mergedList_[surfI] ); } } else if (s.faces().size()) { - formatter_->write - ( - outputDir, - s.name(), - s.points(), - s.faces() - ); + formatter_->write(outputDir, s.name(), s); } } } @@ -107,7 +100,7 @@ Foam::sampledSurfaces::sampledSurfaces outputPath_(fileName::null), fieldSelection_(), interpolationScheme_(word::null), - mergeList_(), + mergedList_(), formatter_(nullptr) { if (Pstream::parRun()) @@ -138,7 +131,7 @@ Foam::sampledSurfaces::sampledSurfaces outputPath_(fileName::null), fieldSelection_(), interpolationScheme_(word::null), - mergeList_(), + mergedList_(), formatter_(nullptr) { read(dict); @@ -239,7 +232,7 @@ bool Foam::sampledSurfaces::read(const dictionary& dict) if (Pstream::parRun()) { - mergeList_.setSize(size()); + mergedList_.setSize(size()); } // Ensure all surfaces and merge information are expired @@ -329,7 +322,7 @@ bool Foam::sampledSurfaces::expire() // Clear merge information if (Pstream::parRun()) { - mergeList_[surfI].clear(); + mergedList_[surfI].clear(); } } @@ -377,24 +370,8 @@ bool Foam::sampledSurfaces::update() if (s.update()) { updated = true; + mergedList_[surfI].merge(s, mergeDim); } - else - { - continue; - } - - PatchTools::gatherAndMerge - ( - mergeDim, - primitivePatch - ( - SubList<face>(s.faces(), s.faces().size()), - s.points() - ), - mergeList_[surfI].points, - mergeList_[surfI].faces, - mergeList_[surfI].pointsMap - ); } return updated; diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H index 5d817632b5bc0e8ddaeea194188fa18632e36be2..1d9c9e730b91a668999fa9b5292804f22c0d2128 100644 --- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H +++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -40,6 +40,7 @@ SourceFiles #include "regionFunctionObject.H" #include "sampledSurface.H" #include "surfaceWriter.H" +#include "mergedSurf.H" #include "volFieldsFwd.H" #include "surfaceFieldsFwd.H" #include "wordReList.H" @@ -64,26 +65,6 @@ class sampledSurfaces public functionObjects::regionFunctionObject, public PtrList<sampledSurface> { - // Private classes - - //- Class used for surface merging information - class mergeInfo - { - public: - pointField points; - faceList faces; - labelList pointsMap; - - //- Clear all storage - void clear() - { - points.clear(); - faces.clear(); - pointsMap.clear(); - } - }; - - // Static data members //- Output verbosity @@ -116,8 +97,8 @@ class sampledSurfaces // surfaces - //- Information for merging surfaces - List<mergeInfo> mergeList_; + //- Merged meshed surfaces (parallel only) + List<mergedSurf> mergedList_; // Calculated diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C index 7925cf25f00c33bfa7ff119713db0b4cdac8ee99..ba39848aad2bd0d809c3e56b2d0a0e615f43b679 100644 --- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C +++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C @@ -65,22 +65,21 @@ void Foam::sampledSurfaces::writeSurface ); // Renumber (point data) to correspond to merged points - if (mergeList_[surfI].pointsMap.size() == allValues.size()) + if (mergedList_[surfI].pointsMap().size() == allValues.size()) { - inplaceReorder(mergeList_[surfI].pointsMap, allValues); - allValues.setSize(mergeList_[surfI].points.size()); + inplaceReorder(mergedList_[surfI].pointsMap(), allValues); + allValues.setSize(mergedList_[surfI].points().size()); } // Write to time directory under outputPath_ // skip surface without faces (eg, a failed cut-plane) - if (mergeList_[surfI].faces.size()) + if (mergedList_[surfI].size()) { sampleFile = formatter_->write ( outputDir, s.name(), - mergeList_[surfI].points, - mergeList_[surfI].faces, + mergedList_[surfI], fieldName, allValues, s.interpolate() @@ -106,8 +105,7 @@ void Foam::sampledSurfaces::writeSurface ( outputDir, s.name(), - s.points(), - s.faces(), + s, fieldName, values, s.interpolate() diff --git a/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMesh.C b/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMesh.C index e0f9eb757bfd2cd9f07541464a67f424d3372977..c1c08006d4542c0dc3caf1f5e41d78bb9d23f851 100644 --- a/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMesh.C +++ b/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMesh.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -305,16 +305,21 @@ bool Foam::sampledTriSurfaceMesh::update(const meshSearch& meshSearcher) // Create faces and points for subsetted surface faceList& faces = this->storedFaces(); faces.setSize(faceMap.size()); + + labelList& zoneIds = this->storedZoneIds(); + zoneIds.setSize(faceMap.size()); + forAll(faceMap, i) { - const triFace& f = s[faceMap[i]]; + const labelledTri& f = s[faceMap[i]]; triFace newF ( reversePointMap[f[0]], reversePointMap[f[1]], reversePointMap[f[2]] ); - faces[i] = newF.triFaceFace(); + faces[i] = newF.triFaceFace(); + zoneIds[i] = f.region(); // preserve zone information forAll(newF, fp) { @@ -773,9 +778,10 @@ Foam::tmp<Foam::tensorField> Foam::sampledTriSurfaceMesh::interpolate void Foam::sampledTriSurfaceMesh::print(Ostream& os) const { os << "sampledTriSurfaceMesh: " << name() << " :" - << " surface:" << surface_.objectRegistry::name() - << " faces:" << faces().size() - << " points:" << points().size(); + << " surface:" << surface_.objectRegistry::name() + << " faces:" << faces().size() + << " points:" << points().size() + << " zoneids:" << zoneIds().size(); } diff --git a/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMesh.H b/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMesh.H index 1d62d0a02aa5399c90cfab0ac80e8579d3a4622a..7403bfc65e24a4888b7b1fb18282646e3d1d4b3d 100644 --- a/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMesh.H +++ b/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMesh.H @@ -87,7 +87,7 @@ class meshSearch; class sampledTriSurfaceMesh : public sampledSurface, - public MeshedSurface<face> + public UnsortedMeshedSurface<face> { public: //- Types of communications @@ -101,7 +101,7 @@ public: private: //- Private typedefs for convenience - typedef MeshedSurface<face> MeshStorage; + typedef UnsortedMeshedSurface<face> MeshStorage; // Private data @@ -213,7 +213,13 @@ public: //- Faces of surface virtual const faceList& faces() const { - return MeshStorage::faces(); + return MeshStorage::surfFaces(); + } + + //- Const access to per-face zone/region information + virtual const labelList& zoneIds() const + { + return MeshStorage::zoneIds(); } //- Face area vectors diff --git a/src/sampling/sampledSurface/thresholdCellFaces/sampledThresholdCellFaces.H b/src/sampling/sampledSurface/thresholdCellFaces/sampledThresholdCellFaces.H index 2fa91d2345848146025ac7cbc2768580ab76d53c..8f097f426272267bef0b9f1a647b3ad7c4584b26 100644 --- a/src/sampling/sampledSurface/thresholdCellFaces/sampledThresholdCellFaces.H +++ b/src/sampling/sampledSurface/thresholdCellFaces/sampledThresholdCellFaces.H @@ -145,7 +145,13 @@ public: //- Faces of surface virtual const faceList& faces() const { - return MeshStorage::faces(); + return MeshStorage::surfFaces(); + } + + //- Const access to per-face zone/region information + virtual const labelList& zoneIds() const + { + return Foam::emptyLabelList; } //- Face area vectors (normals) diff --git a/src/sampling/sampledSurface/writers/boundaryData/boundaryDataSurfaceWriter.C b/src/sampling/sampledSurface/writers/boundaryData/boundaryDataSurfaceWriter.C index 076a9a42260dc1ecf0c4894d903fd4dcfc2c2574..aaf7aebd7879685f84e2c9e3ad085a23c582c732 100644 --- a/src/sampling/sampledSurface/writers/boundaryData/boundaryDataSurfaceWriter.C +++ b/src/sampling/sampledSurface/writers/boundaryData/boundaryDataSurfaceWriter.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -53,14 +53,14 @@ Foam::fileName Foam::boundaryDataSurfaceWriter::write ( const fileName& outputDir, const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const bool verbose ) const { const fileName baseDir(outputDir.path()/surfaceName); const fileName timeName(outputDir.name()); + const pointField& points = surf.points(); // Construct dummy time to use as an objectRegistry const fileName caseDir(getEnv("FOAM_CASE")); @@ -110,6 +110,8 @@ Foam::fileName Foam::boundaryDataSurfaceWriter::write } +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + // create write methods defineSurfaceWriterWriteFields(Foam::boundaryDataSurfaceWriter); diff --git a/src/sampling/sampledSurface/writers/boundaryData/boundaryDataSurfaceWriter.H b/src/sampling/sampledSurface/writers/boundaryData/boundaryDataSurfaceWriter.H index b70b4d47c5b0be71102b019f25baa1baf7d4eea6..57da092b71ad15f8e6cce4742bc7d69bfc6b5912 100644 --- a/src/sampling/sampledSurface/writers/boundaryData/boundaryDataSurfaceWriter.H +++ b/src/sampling/sampledSurface/writers/boundaryData/boundaryDataSurfaceWriter.H @@ -2,8 +2,8 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2015 OpenCFD Ltd. - \\/ M anipulation | + \\ / A nd | Copyright (C) 2015-2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -98,8 +98,7 @@ class boundaryDataSurfaceWriter ( const fileName& outputDir, const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, const Field<Type>& values, const bool isNodeValues, @@ -130,10 +129,9 @@ public: ( const fileName& outputDir, const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const bool verbose = false - ) const; + ) const; // override //- Write scalarField for a single surface to file. @@ -142,13 +140,12 @@ public: ( const fileName& outputDir, // <case>/surface/TIME const fileName& surfaceName, // name of surface - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, // name of field const Field<scalar>& values, const bool isNodeValues, const bool verbose = false - ) const; + ) const; // override //- Write vectorField for a single surface to file. // One value per face or vertex (isNodeValues = true) @@ -156,13 +153,12 @@ public: ( const fileName& outputDir, // <case>/surface/TIME const fileName& surfaceName, // name of surface - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, // name of field const Field<vector>& values, const bool isNodeValues, const bool verbose = false - ) const; + ) const; // override //- Write sphericalTensorField for a single surface to file. // One value per face or vertex (isNodeValues = true) @@ -170,13 +166,12 @@ public: ( const fileName& outputDir, // <case>/surface/TIME const fileName& surfaceName, // name of surface - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, // name of field const Field<sphericalTensor>& values, const bool isNodeValues, const bool verbose = false - ) const; + ) const; // override //- Write symmTensorField for a single surface to file. // One value per face or vertex (isNodeValues = true) @@ -184,13 +179,12 @@ public: ( const fileName& outputDir, // <case>/surface/TIME const fileName& surfaceName, // name of surface - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, // name of field const Field<symmTensor>& values, const bool isNodeValues, const bool verbose = false - ) const; + ) const; // override //- Write tensorField for a single surface to file. // One value per face or vertex (isNodeValues = true) @@ -198,13 +192,12 @@ public: ( const fileName& outputDir, // <case>/surface/TIME const fileName& surfaceName, // name of surface - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, // name of field const Field<tensor>& values, const bool isNodeValues, const bool verbose = false - ) const; + ) const; // override }; diff --git a/src/sampling/sampledSurface/writers/boundaryData/boundaryDataSurfaceWriterTemplates.C b/src/sampling/sampledSurface/writers/boundaryData/boundaryDataSurfaceWriterTemplates.C index ec0db202d584d3ad82c8126b28721cfc80d60e5f..dcc9452d00bf1b1731326f60a135279512db2e58 100644 --- a/src/sampling/sampledSurface/writers/boundaryData/boundaryDataSurfaceWriterTemplates.C +++ b/src/sampling/sampledSurface/writers/boundaryData/boundaryDataSurfaceWriterTemplates.C @@ -37,8 +37,7 @@ Foam::fileName Foam::boundaryDataSurfaceWriter::writeTemplate ( const fileName& outputDir, const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, const Field<Type>& values, const bool isNodeValues, @@ -48,6 +47,9 @@ Foam::fileName Foam::boundaryDataSurfaceWriter::writeTemplate const fileName baseDir(outputDir.path()/surfaceName); const fileName timeName(outputDir.name()); + const pointField& points = surf.points(); + const faceList& faces = surf.faces(); + // Construct dummy time to use as an objectRegistry const fileName caseDir(getEnv("FOAM_CASE")); diff --git a/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.C b/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.C index 27015fe21e9baebb8b9159ded7e4ced1a52b4e52..6f060732570df4b8219498e4138264a5d0004b2f 100644 --- a/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.C +++ b/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -39,10 +39,12 @@ namespace Foam void Foam::dxSurfaceWriter::writeGeometry ( Ostream& os, - const pointField& points, - const faceList& faces + const meshedSurf& surf ) { + const pointField& points = surf.points(); + const faceList& faces = surf.faces(); + // Write vertex coordinates os << "# The irregular positions" << nl diff --git a/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.H b/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.H index 51eceeda3e5e765d6172b8bef02a8bc08d5efc25..8a169d3beb41c289599e09a76b9d5716e1d8c762 100644 --- a/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.H +++ b/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -53,7 +53,7 @@ class dxSurfaceWriter // Private Member Functions - static void writeGeometry(Ostream&, const pointField&, const faceList&); + static void writeGeometry(Ostream&, const meshedSurf&); static void writeTrailer(Ostream&, const bool isNodeValues); template<class Type> @@ -65,8 +65,7 @@ class dxSurfaceWriter ( const fileName& outputDir, const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, const Field<Type>& values, const bool isNodeValues, @@ -98,13 +97,12 @@ public: ( const fileName& outputDir, // <case>/surface/TIME const fileName& surfaceName, // name of surface - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, // name of field const Field<scalar>& values, const bool isNodeValues, const bool verbose = false - ) const; + ) const; // override //- Write vectorField for a single surface to file. // One value per face or vertex (isNodeValues = true) @@ -112,13 +110,12 @@ public: ( const fileName& outputDir, // <case>/surface/TIME const fileName& surfaceName, // name of surface - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, // name of field const Field<vector>& values, const bool isNodeValues, const bool verbose = false - ) const; + ) const; // override //- Write sphericalTensorField for a single surface to file. // One value per face or vertex (isNodeValues = true) @@ -126,13 +123,12 @@ public: ( const fileName& outputDir, // <case>/surface/TIME const fileName& surfaceName, // name of surface - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, // name of field const Field<sphericalTensor>& values, const bool isNodeValues, const bool verbose = false - ) const; + ) const; // override //- Write symmTensorField for a single surface to file. // One value per face or vertex (isNodeValues = true) @@ -140,13 +136,12 @@ public: ( const fileName& outputDir, // <case>/surface/TIME const fileName& surfaceName, // name of surface - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, // name of field const Field<symmTensor>& values, const bool isNodeValues, const bool verbose = false - ) const; + ) const; // override //- Write tensorField for a single surface to file. // One value per face or vertex (isNodeValues = true) @@ -154,13 +149,12 @@ public: ( const fileName& outputDir, // <case>/surface/TIME const fileName& surfaceName, // name of surface - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, // name of field const Field<tensor>& values, const bool isNodeValues, const bool verbose = false - ) const; + ) const; // override }; diff --git a/src/sampling/sampledSurface/writers/dx/dxSurfaceWriterTemplates.C b/src/sampling/sampledSurface/writers/dx/dxSurfaceWriterTemplates.C index 835f2b2b952f1cbf1a72539f70ba4f8de9144411..f9bb67c99a089038d4e8e326a0c12deda667c0e1 100644 --- a/src/sampling/sampledSurface/writers/dx/dxSurfaceWriterTemplates.C +++ b/src/sampling/sampledSurface/writers/dx/dxSurfaceWriterTemplates.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -50,8 +50,7 @@ Foam::fileName Foam::dxSurfaceWriter::writeTemplate ( const fileName& outputDir, const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, const Field<Type>& values, const bool isNodeValues, @@ -70,7 +69,7 @@ Foam::fileName Foam::dxSurfaceWriter::writeTemplate Info<< "Writing field " << fieldName << " to " << os.name() << endl; } - writeGeometry(os, points, faces); + writeGeometry(os, surf); writeData(os, values); writeTrailer(os, isNodeValues); diff --git a/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.C b/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.C index ac2457010d9d69cdb5e9a68dcdc5f7bd6b40a746..fd89f72f5a3e89b0b4375e898fdad39abca0a4e2 100644 --- a/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.C +++ b/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.C @@ -84,11 +84,12 @@ Foam::fileName Foam::ensightSurfaceWriter::write ( const fileName& outputDir, const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const bool verbose ) const { + const pointField& points = surf.points(); + const faceList& faces = surf.faces(); const ensight::FileName surfName(surfaceName); if (!isDir(outputDir)) diff --git a/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.H b/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.H index 9d5ff392b41f92fb7fab3ddc59e9b25a179a3c51..58325c1a2640e006269b2cdfd890917c6648dc54 100644 --- a/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.H +++ b/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.H @@ -67,8 +67,7 @@ class ensightSurfaceWriter ( const fileName& outputDir, const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, const Field<Type>& values, const bool isNodeValues, @@ -81,8 +80,7 @@ class ensightSurfaceWriter ( const fileName& outputDir, const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, const Field<Type>& values, const bool isNodeValues, @@ -95,8 +93,7 @@ class ensightSurfaceWriter ( const fileName& outputDir, const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, const Field<Type>& values, const bool isNodeValues, @@ -135,10 +132,9 @@ public: ( const fileName& outputDir, const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const bool verbose = false - ) const; + ) const; // override //- Write scalarField for a single surface to file. @@ -147,13 +143,12 @@ public: ( const fileName& outputDir, // <case>/surface/TIME const fileName& surfaceName, // name of surface - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, // name of field const Field<scalar>& values, const bool isNodeValues, const bool verbose = false - ) const; + ) const; // override //- Write vectorField for a single surface to file. // One value per face or vertex (isNodeValues = true) @@ -161,13 +156,12 @@ public: ( const fileName& outputDir, // <case>/surface/TIME const fileName& surfaceName, // name of surface - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, // name of field const Field<vector>& values, const bool isNodeValues, const bool verbose = false - ) const; + ) const; // override //- Write sphericalTensorField for a single surface to file. // One value per face or vertex (isNodeValues = true) @@ -175,13 +169,12 @@ public: ( const fileName& outputDir, // <case>/surface/TIME const fileName& surfaceName, // name of surface - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, // name of field const Field<sphericalTensor>& values, const bool isNodeValues, const bool verbose = false - ) const; + ) const; // override //- Write symmTensorField for a single surface to file. // One value per face or vertex (isNodeValues = true) @@ -189,13 +182,12 @@ public: ( const fileName& outputDir, // <case>/surface/TIME const fileName& surfaceName, // name of surface - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, // name of field const Field<symmTensor>& values, const bool isNodeValues, const bool verbose = false - ) const; + ) const; // override //- Write tensorField for a single surface to file. // One value per face or vertex (isNodeValues = true) @@ -203,13 +195,12 @@ public: ( const fileName& outputDir, // <case>/surface/TIME const fileName& surfaceName, // name of surface - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, // name of field const Field<tensor>& values, const bool isNodeValues, const bool verbose = false - ) const; + ) const; // override }; diff --git a/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriterTemplates.C b/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriterTemplates.C index 01a0716a9d47458935ef47d2056b21171633b4d0..34d218dac8d79d625e348c010d38b22ac23850f1 100644 --- a/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriterTemplates.C +++ b/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriterTemplates.C @@ -40,8 +40,7 @@ Foam::fileName Foam::ensightSurfaceWriter::writeUncollated ( const fileName& outputDir, const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, const Field<Type>& values, const bool isNodeValues, @@ -117,7 +116,14 @@ Foam::fileName Foam::ensightSurfaceWriter::writeUncollated << " " << timeValue << nl << nl << "# end" << nl; - ensightPartFaces ensPart(0, osGeom.name().name(), points, faces, true); + ensightPartFaces ensPart + ( + 0, + osGeom.name().name(), + surf.points(), + surf.faces(), + true // contiguous points + ); osGeom << ensPart; // Write field @@ -139,8 +145,7 @@ Foam::fileName Foam::ensightSurfaceWriter::writeCollated ( const fileName& outputDir, const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, const Field<Type>& values, const bool isNodeValues, @@ -310,7 +315,14 @@ Foam::fileName Foam::ensightSurfaceWriter::writeCollated // Write geometry - ensightPartFaces ensPart(0, meshFile.name(), points, faces, true); + ensightPartFaces ensPart + ( + 0, + meshFile.name(), + surf.points(), + surf.faces(), + true // contiguous points + ); if (!exists(meshFile)) { if (verbose) @@ -377,8 +389,7 @@ Foam::fileName Foam::ensightSurfaceWriter::writeTemplate ( const fileName& outputDir, const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, const Field<Type>& values, const bool isNodeValues, @@ -391,8 +402,7 @@ Foam::fileName Foam::ensightSurfaceWriter::writeTemplate ( outputDir, surfaceName, - points, - faces, + surf, fieldName, values, isNodeValues, @@ -405,8 +415,7 @@ Foam::fileName Foam::ensightSurfaceWriter::writeTemplate ( outputDir, surfaceName, - points, - faces, + surf, fieldName, values, isNodeValues, diff --git a/src/sampling/sampledSurface/writers/foam/foamSurfaceWriter.C b/src/sampling/sampledSurface/writers/foam/foamSurfaceWriter.C index 4471a002ee758f33cc7701664f2a467418dcb25a..4a59a92347557edcd6340f604095ff1a7182bd40 100644 --- a/src/sampling/sampledSurface/writers/foam/foamSurfaceWriter.C +++ b/src/sampling/sampledSurface/writers/foam/foamSurfaceWriter.C @@ -24,10 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "foamSurfaceWriter.H" - #include "OFstream.H" -#include "OSspecific.H" - #include "makeSurfaceWriterMethods.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -58,11 +55,13 @@ Foam::fileName Foam::foamSurfaceWriter::write ( const fileName& outputDir, const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const bool verbose ) const { + const pointField& points = surf.points(); + const faceList& faces = surf.faces(); + fileName surfaceDir(outputDir/surfaceName); if (!isDir(surfaceDir)) diff --git a/src/sampling/sampledSurface/writers/foam/foamSurfaceWriter.H b/src/sampling/sampledSurface/writers/foam/foamSurfaceWriter.H index 8b541c6162a0007cc92e498338fd1a8b64593d4d..cc9bdc661e6f1c88249d947f092027ed23e9521b 100644 --- a/src/sampling/sampledSurface/writers/foam/foamSurfaceWriter.H +++ b/src/sampling/sampledSurface/writers/foam/foamSurfaceWriter.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -43,7 +43,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class foamSurfaceWriter Declaration + Class foamSurfaceWriter Declaration \*---------------------------------------------------------------------------*/ class foamSurfaceWriter @@ -58,8 +58,7 @@ class foamSurfaceWriter ( const fileName& outputDir, const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, const Field<Type>& values, const bool isNodeValues, @@ -97,10 +96,9 @@ public: ( const fileName& outputDir, const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const bool verbose = false - ) const; + ) const; // override //- Write scalarField for a single surface to file. @@ -109,13 +107,12 @@ public: ( const fileName& outputDir, // <case>/surface/TIME const fileName& surfaceName, // name of surface - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, // name of field const Field<scalar>& values, const bool isNodeValues, const bool verbose = false - ) const; + ) const; // override //- Write vectorField for a single surface to file. // One value per face or vertex (isNodeValues = true) @@ -123,13 +120,12 @@ public: ( const fileName& outputDir, // <case>/surface/TIME const fileName& surfaceName, // name of surface - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, // name of field const Field<vector>& values, const bool isNodeValues, const bool verbose = false - ) const; + ) const; // override //- Write sphericalTensorField for a single surface to file. // One value per face or vertex (isNodeValues = true) @@ -137,13 +133,12 @@ public: ( const fileName& outputDir, // <case>/surface/TIME const fileName& surfaceName, // name of surface - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, // name of field const Field<sphericalTensor>& values, const bool isNodeValues, const bool verbose = false - ) const; + ) const; // override //- Write symmTensorField for a single surface to file. // One value per face or vertex (isNodeValues = true) @@ -151,13 +146,12 @@ public: ( const fileName& outputDir, // <case>/surface/TIME const fileName& surfaceName, // name of surface - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, // name of field const Field<symmTensor>& values, const bool isNodeValues, const bool verbose = false - ) const; + ) const; // override //- Write tensorField for a single surface to file. // One value per face or vertex (isNodeValues = true) @@ -165,13 +159,12 @@ public: ( const fileName& outputDir, // <case>/surface/TIME const fileName& surfaceName, // name of surface - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, // name of field const Field<tensor>& values, const bool isNodeValues, const bool verbose = false - ) const; + ) const; // override }; diff --git a/src/sampling/sampledSurface/writers/foam/foamSurfaceWriterTemplates.C b/src/sampling/sampledSurface/writers/foam/foamSurfaceWriterTemplates.C index c21909d653dd7ec5ea8607b3a950b838b721c3ab..1a9f1736a5bfd84d1199f17913a5409a3804ffaf 100644 --- a/src/sampling/sampledSurface/writers/foam/foamSurfaceWriterTemplates.C +++ b/src/sampling/sampledSurface/writers/foam/foamSurfaceWriterTemplates.C @@ -33,8 +33,7 @@ Foam::fileName Foam::foamSurfaceWriter::writeTemplate ( const fileName& outputDir, const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, const Field<Type>& values, const bool isNodeValues, diff --git a/src/sampling/sampledSurface/writers/makeSurfaceWriterMethods.H b/src/sampling/sampledSurface/writers/makeSurfaceWriterMethods.H index 448cff18c5a8d36190af7dc9af7305bf11cdae7b..fadcf23ad2f335e5ecf7fc7f6f9af9ab712e3bc4 100644 --- a/src/sampling/sampledSurface/writers/makeSurfaceWriterMethods.H +++ b/src/sampling/sampledSurface/writers/makeSurfaceWriterMethods.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -51,20 +51,18 @@ namespace Foam ( \ const fileName& outputDir, \ const fileName& surfaceName, \ - const pointField& points, \ - const faceList& faces, \ + const meshedSurf& surf, \ const word& fieldName, \ const Field<FieldType>& values, \ const bool isNodeValues, \ const bool verbose \ ) const \ { \ - return writeTemplate \ + return writeTemplate \ ( \ outputDir, \ surfaceName, \ - points, \ - faces, \ + surf, \ fieldName, \ values, \ isNodeValues, \ diff --git a/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriter.C b/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriter.C index 11c6dcff47d3801990773dd92214a09c5b6577e9..384192756d1beeabe484600a3c2e77fef2ebaf17 100644 --- a/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriter.C +++ b/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriter.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -25,7 +25,8 @@ License #include "nastranSurfaceWriter.H" #include "IOmanip.H" -#include "Tuple2.H" +#include "Pair.H" +#include "HashSet.H" #include "makeSurfaceWriterMethods.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -64,7 +65,7 @@ namespace Foam // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void Foam::nastranSurfaceWriter::formatOS(OFstream& os) const +void Foam::nastranSurfaceWriter::formatOS(Ostream& os) const { os.setf(ios_base::scientific); @@ -75,19 +76,23 @@ void Foam::nastranSurfaceWriter::formatOS(OFstream& os) const label offset = 7; switch (writeFormat_) { - case (wfShort): + case wfShort: { prec = 8 - offset; break; } - case (wfFree): - case (wfLong): + + case wfFree: + case wfLong: { prec = 16 - offset; break; } + default: { + FatalErrorInFunction + << "Unknown writeFormat enumeration" << abort(FatalError); } } @@ -95,10 +100,10 @@ void Foam::nastranSurfaceWriter::formatOS(OFstream& os) const } -void Foam::nastranSurfaceWriter::writeKeyword +Foam::Ostream& Foam::nastranSurfaceWriter::writeKeyword ( - const word& keyword, - Ostream& os + Ostream& os, + const word& keyword ) const { os.setf(ios_base::left); @@ -110,11 +115,13 @@ void Foam::nastranSurfaceWriter::writeKeyword os << setw(8) << keyword; break; } + case wfLong: { os << setw(8) << word(keyword + '*'); break; } + case wfFree: { os << keyword; @@ -123,14 +130,16 @@ void Foam::nastranSurfaceWriter::writeKeyword } os.unsetf(ios_base::left); + + return os; } void Foam::nastranSurfaceWriter::writeCoord ( + Ostream& os, const point& p, - const label pointi, - OFstream& os + const label pointI ) const { // Fixed short/long formats: @@ -144,21 +153,14 @@ void Foam::nastranSurfaceWriter::writeCoord // 8 PS : single point constraints (blank) // 9 SEID : super-element ID - - writeKeyword("GRID", os); - - os << separator_; + writeKeyword(os, "GRID") << separator_; os.setf(ios_base::right); - writeValue(pointi + 1, os); - os << separator_; - writeValue("", os); - os << separator_; - writeValue(p.x(), os); - os << separator_; - writeValue(p.y(), os); - os << separator_; + writeValue(os, pointI+1) << separator_; + writeValue(os, "") << separator_; + writeValue(os, p.x()) << separator_; + writeValue(os, p.y()) << separator_; switch (writeFormat_) { @@ -167,27 +169,26 @@ void Foam::nastranSurfaceWriter::writeCoord os << setw(8) << p.z() << nl; os.unsetf(ios_base::right); - break; } + case wfLong: { os << nl; os.unsetf(ios_base::right); - writeKeyword("", os); + writeKeyword(os, ""); os.setf(ios_base::right); - writeValue(p.z(), os); - os << nl; + writeValue(os, p.z()) << nl; break; } + case wfFree: { - writeValue(p.z(), os); - os << nl; - + writeValue(os, p.z()) << nl; break; } + default: { FatalErrorInFunction @@ -201,10 +202,11 @@ void Foam::nastranSurfaceWriter::writeCoord void Foam::nastranSurfaceWriter::writeFace ( + Ostream& os, const word& faceType, - const labelList& facePts, - label& nFace, - OFstream& os + const labelUList& facePts, + const label nFace, + const label PID ) const { // Only valid surface elements are CTRIA3 and CQUAD4 @@ -221,19 +223,12 @@ void Foam::nastranSurfaceWriter::writeFace // For CTRIA3 elements, cols 7 onwards are not used - label PID = 1; - - writeKeyword(faceType, os); - - os << separator_; + writeKeyword(os, faceType) << separator_; os.setf(ios_base::right); - writeValue(nFace++, os); - - os << separator_; - - writeValue(PID, os); + writeValue(os, nFace) << separator_; + writeValue(os, PID); switch (writeFormat_) { @@ -241,7 +236,7 @@ void Foam::nastranSurfaceWriter::writeFace { forAll(facePts, i) { - writeValue(facePts[i] + 1, os); + writeValue(os, facePts[i] + 1); } break; @@ -250,12 +245,12 @@ void Foam::nastranSurfaceWriter::writeFace { forAll(facePts, i) { - writeValue(facePts[i] + 1, os); + writeValue(os, facePts[i] + 1); if (i == 1) { os << nl; os.unsetf(ios_base::right); - writeKeyword("", os); + writeKeyword(os, ""); os.setf(ios_base::right); } } @@ -267,7 +262,7 @@ void Foam::nastranSurfaceWriter::writeFace forAll(facePts, i) { os << separator_; - writeValue(facePts[i] + 1, os); + writeValue(os, facePts[i] + 1); } break; @@ -286,12 +281,15 @@ void Foam::nastranSurfaceWriter::writeFace void Foam::nastranSurfaceWriter::writeGeometry ( - const pointField& points, - const faceList& faces, - List<DynamicList<face>>& decomposedFaces, - OFstream& os + Ostream& os, + const meshedSurf& surf, + List<DynamicList<face>>& decomposedFaces ) const { + const pointField& points = surf.points(); + const faceList& faces = surf.faces(); + const labelList& zones = surf.zoneIds(); + // Write points os << "$" << nl @@ -300,31 +298,33 @@ void Foam::nastranSurfaceWriter::writeGeometry forAll(points, pointi) { - writeCoord(points[pointi], pointi, os); + writeCoord(os, points[pointi], pointi); } - // Write faces + decomposedFaces.clear(); + decomposedFaces.setSize(faces.size()); os << "$" << nl << "$ Faces" << nl << "$" << nl; - label nFace = 1; - + label nFace = 0; // the element-id forAll(faces, facei) { const face& f = faces[facei]; + // 1-offset for PID + const label PID = 1 + (facei < zones.size() ? zones[facei] : 0); if (f.size() == 3) { - writeFace("CTRIA3", faces[facei], nFace, os); - decomposedFaces[facei].append(faces[facei]); + writeFace(os, "CTRIA3", f, ++nFace, PID); + decomposedFaces[facei].append(f); } else if (f.size() == 4) { - writeFace("CQUAD4", faces[facei], nFace, os); - decomposedFaces[facei].append(faces[facei]); + writeFace(os, "CQUAD4", f, ++nFace, PID); + decomposedFaces[facei].append(f); } else { @@ -335,7 +335,7 @@ void Foam::nastranSurfaceWriter::writeGeometry forAll(triFaces, trii) { - writeFace("CTRIA3", triFaces[trii], nFace, os); + writeFace(os, "CTRIA3", triFaces[trii], ++nFace, PID); decomposedFaces[facei].append(triFaces[trii]); } } @@ -343,39 +343,51 @@ void Foam::nastranSurfaceWriter::writeGeometry } -void Foam::nastranSurfaceWriter::writeFooter(Ostream& os) const +Foam::Ostream& Foam::nastranSurfaceWriter::writeFooter +( + Ostream& os, + const meshedSurf& surf +) const { - label PID = 1; - - writeKeyword("PSHELL", os); - - os << separator_; + // zone id have been used for the PID. Find unique values. - writeValue(PID, os); + labelList pidsUsed = labelHashSet(surf.zoneIds()).sortedToc(); + if (pidsUsed.empty()) + { + pidsUsed.setSize(1, Zero); // fallback + } - for (label i = 0; i < 7; i++) + for (auto pid : pidsUsed) { - // Dummy values - os << separator_; - writeValue(1, os); + writeKeyword(os, "PSHELL") << separator_; + writeValue(os, pid+1); // 1-offset for PID + + for (label i = 0; i < 7; ++i) + { + // Dummy values + os << separator_; + writeValue(os, 1); + } + os << nl; } - os << nl; - writeKeyword("MAT1", os); - os << separator_; + + // use single material ID label MID = 1; - writeValue(MID, os); + writeKeyword(os, "MAT1") << separator_; + writeValue(os, MID); - for (label i = 0; i < 7; i++) + for (label i = 0; i < 7; ++i) { // Dummy values os << separator_; - writeValue("", os); + writeValue(os, ""); } - os << nl; + + return os; } @@ -400,7 +412,10 @@ Foam::nastranSurfaceWriter::nastranSurfaceWriter(const dictionary& options) { if (options.found("format")) { - writeFormat_ = writeFormatNames_.read(options.lookup("format")); + writeFormat_ = writeFormatNames_.read + ( + options.lookup("format") + ); } if (writeFormat_ == wfFree) @@ -408,7 +423,7 @@ Foam::nastranSurfaceWriter::nastranSurfaceWriter(const dictionary& options) separator_ = ","; } - List<Tuple2<word, word>> fieldSet(options.lookup("fields")); + List<Pair<word>> fieldSet(options.lookup("fields")); forAll(fieldSet, i) { @@ -431,8 +446,7 @@ Foam::fileName Foam::nastranSurfaceWriter::write ( const fileName& outputDir, const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const bool verbose ) const { @@ -449,22 +463,16 @@ Foam::fileName Foam::nastranSurfaceWriter::write Info<< "Writing nastran file to " << os.name() << endl; } - os << "TITLE=OpenFOAM " << surfaceName.c_str() << " mesh" << nl + os << "TITLE=OpenFOAM " << surfaceName.c_str() + << " mesh" << nl << "$" << nl << "BEGIN BULK" << nl; - List<DynamicList<face>> decomposedFaces(faces.size()); - - writeGeometry(points, faces, decomposedFaces, os); - - if (!isDir(outputDir)) - { - mkDir(outputDir); - } - - writeFooter(os); + List<DynamicList<face>> decomposedFaces; + writeGeometry(os, surf, decomposedFaces); - os << "ENDDATA" << endl; + writeFooter(os, surf) + << "ENDDATA" << endl; return os.name(); } diff --git a/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriter.H b/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriter.H index ae0cc8c8390daf07d9cf9b51147c11a43bc414d4..921182af987ff1bf1eae33cca473ee450903fe3a 100644 --- a/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriter.H +++ b/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriter.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -27,6 +27,7 @@ Class Description A surface writer for the Nastran file format - both surface mesh and fields + \verbatim formatOptions { nastran @@ -43,6 +44,7 @@ Description format free; //short, long, free } }; + \endverbatim SourceFiles nastranSurfaceWriter.C @@ -80,26 +82,25 @@ public: wfFree }; - static const NamedEnum<writeFormat, 3> writeFormatNames_; - enum dataFormat { dfPLOAD2, dfPLOAD4 }; - static const NamedEnum<dataFormat, 2> dataFormatNames_; - private: // Private data + static const NamedEnum<writeFormat, 3> writeFormatNames_; + static const NamedEnum<dataFormat, 2> dataFormatNames_; + //- Write option writeFormat writeFormat_; //- Mapping from field name to data format enumeration - HashTable<dataFormat, word> fieldMap_; + HashTable<dataFormat> fieldMap_; //- Scale to apply to values (default = 1.0) scalar scale_; @@ -110,71 +111,67 @@ private: // Private Member Functions - //- Initialise the output stream format params - void formatOS(OFstream& os) const; + //- Initialise the output stream format parameters + void formatOS(Ostream& os) const; - //- Write a co-ordinate + //- Write a coordinate void writeCoord ( + Ostream& os, const point& p, - const label pointi, - OFstream& os + const label pointI //!< 0-based Point Id ) const; //- Write a face element (CTRIA3 or CQUAD4) void writeFace ( + Ostream& os, const word& faceType, - const labelList& facePts, - label& nFace, - OFstream& os + const labelUList& facePts, + const label EID, //!< 1-based Element Id + const label PID //!< 1-based Property Id ) const; //- Main driver to write the surface mesh geometry void writeGeometry ( - const pointField& points, - const faceList& faces, - List<DynamicList<face>>& decomposedFaces, - OFstream& os + Ostream& os, + const meshedSurf& surf, + List<DynamicList<face>>& decomposedFaces ) const; //- Write the formatted keyword to the output stream - void writeKeyword + Ostream& writeKeyword ( - const word& keyword, - Ostream& os + Ostream& os, + const word& keyword ) const; //- Write the footer information - void writeFooter(Ostream& os) const; + Ostream& writeFooter(Ostream& os, const meshedSurf& surf) const; //- Write a formatted value to the output stream template<class Type> - void writeValue - ( - const Type& value, - Ostream& os - ) const; + Ostream& writeValue(Ostream& os, const Type& value) const; //- Write a face-based value template<class Type> - void writeFaceValue + Ostream& writeFaceValue ( + Ostream& os, const dataFormat& format, const Type& value, - const label EID, - Ostream& os + const label EID //!< 1-based Element Id ) const; + //- Templated write operation template<class Type> fileName writeTemplate ( const fileName& outputDir, const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, const Field<Type>& values, const bool isNodeValues, @@ -215,10 +212,9 @@ public: ( const fileName& outputDir, const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const bool verbose = false - ) const; + ) const; // override //- Write scalarField for a single surface to file. // One value per face or vertex (isNodeValues = true) @@ -226,13 +222,12 @@ public: ( const fileName& outputDir, const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, const Field<scalar>& values, const bool isNodeValues, const bool verbose = false - ) const; + ) const; // override //- Write vectorField for a single surface to file. // One value per face or vertex (isNodeValues = true) @@ -240,13 +235,12 @@ public: ( const fileName& outputDir, const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, const Field<vector>& values, const bool isNodeValues, const bool verbose = false - ) const; + ) const; // override //- Write sphericalTensorField for a single surface to file. // One value per face or vertex (isNodeValues = true) @@ -254,13 +248,12 @@ public: ( const fileName& outputDir, const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, const Field<sphericalTensor>& values, const bool isNodeValues, const bool verbose = false - ) const; + ) const; // override //- Write symmTensorField for a single surface to file. // One value per face or vertex (isNodeValues = true) @@ -268,13 +261,12 @@ public: ( const fileName& outputDir, const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, const Field<symmTensor>& values, const bool isNodeValues, const bool verbose = false - ) const; + ) const; // override //- Write tensorField for a single surface to file. // One value per face or vertex (isNodeValues = true) @@ -282,13 +274,12 @@ public: ( const fileName& outputDir, const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, const Field<tensor>& values, const bool isNodeValues, const bool verbose = false - ) const; + ) const; // override }; diff --git a/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriterTemplates.C b/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriterTemplates.C index 412bbeb0f30c0f6c635d1ef636555840487e517e..048088791c86cd4529eeef3f5de7ad0cf134e68f 100644 --- a/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriterTemplates.C +++ b/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriterTemplates.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -30,10 +30,10 @@ License // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // template<class Type> -void Foam::nastranSurfaceWriter::writeValue +Foam::Ostream& Foam::nastranSurfaceWriter::writeValue ( - const Type& value, - Ostream& os + Ostream& os, + const Type& value ) const { switch (writeFormat_) @@ -54,16 +54,18 @@ void Foam::nastranSurfaceWriter::writeValue break; } } + + return os; } template<class Type> -void Foam::nastranSurfaceWriter::writeFaceValue +Foam::Ostream& Foam::nastranSurfaceWriter::writeFaceValue ( + Ostream& os, const dataFormat& format, const Type& value, - const label EID, - Ostream& os + const label EID ) const { // Fixed short/long formats supporting PLOAD2 and PLOAD4: @@ -84,16 +86,13 @@ void Foam::nastranSurfaceWriter::writeFaceValue Type scaledValue = scale_*value; - // Write Keyword - writeKeyword(dataFormatNames_[format], os); - - os << separator_; + // Write keyword + writeKeyword(os, dataFormatNames_[format]) << separator_; // Write load set ID os.setf(ios_base::right); - writeValue(SID, os); - os << separator_; + writeValue(os, SID) << separator_; switch (format) { @@ -101,7 +100,7 @@ void Foam::nastranSurfaceWriter::writeFaceValue { if (pTraits<Type>::nComponents == 1) { - writeValue(scaledValue, os); + writeValue(os, scaledValue) << separator_; } else { @@ -110,25 +109,25 @@ void Foam::nastranSurfaceWriter::writeFaceValue << "and cannot be used for higher rank values" << endl; - writeValue(scalar(0), os); + writeValue(os, scalar(0)) << separator_; } - os << separator_; - writeValue(EID, os); - + writeValue(os, EID); break; } + case dfPLOAD4: { - writeValue(EID, os); + writeValue(os, EID); - for (direction dirI = 0; dirI < pTraits<Type>::nComponents; dirI++) + for (direction dirI = 0; dirI < pTraits<Type>::nComponents; ++dirI) { os << separator_; - writeValue(component(scaledValue, dirI), os); + writeValue(os, component(scaledValue, dirI)); } break; } + default: { FatalErrorInFunction @@ -140,6 +139,8 @@ void Foam::nastranSurfaceWriter::writeFaceValue os.unsetf(ios_base::right); os << nl; + + return os; } @@ -148,8 +149,7 @@ Foam::fileName Foam::nastranSurfaceWriter::writeTemplate ( const fileName& outputDir, const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, const Field<Type>& values, const bool isNodeValues, @@ -185,17 +185,15 @@ Foam::fileName Foam::nastranSurfaceWriter::writeTemplate Info<< "Writing nastran file to " << os.name() << endl; } - os << "TITLE=OpenFOAM " << surfaceName.c_str() << " " << fieldName - << " data" << nl + os << "TITLE=OpenFOAM " << surfaceName.c_str() + << " " << fieldName << " data" << nl << "$" << nl << "TIME " << timeValue << nl << "$" << nl << "BEGIN BULK" << nl; - List<DynamicList<face>> decomposedFaces(faces.size()); - - writeGeometry(points, faces, decomposedFaces, os); - + List<DynamicList<face>> decomposedFaces; + writeGeometry(os, surf, decomposedFaces); os << "$" << nl << "$ Field data" << nl @@ -203,7 +201,7 @@ Foam::fileName Foam::nastranSurfaceWriter::writeTemplate if (isNodeValues) { - label n = 0; + label elemId = 0; forAll(decomposedFaces, i) { @@ -219,28 +217,26 @@ Foam::fileName Foam::nastranSurfaceWriter::writeTemplate } v /= f.size(); - writeFaceValue(format, v, ++n, os); + writeFaceValue(os, format, v, ++elemId); } } } else { - label n = 0; + label elemId = 0; forAll(decomposedFaces, i) { const DynamicList<face>& dFaces = decomposedFaces[i]; - forAll(dFaces, facei) { - writeFaceValue(format, values[facei], ++n, os); + writeFaceValue(os, format, values[facei], ++elemId); } } } - writeFooter(os); - - os << "ENDDATA" << endl; + writeFooter(os, surf) + << "ENDDATA" << endl; return os.name(); } diff --git a/src/sampling/sampledSurface/writers/proxy/proxySurfaceWriter.C b/src/sampling/sampledSurface/writers/proxy/proxySurfaceWriter.C index c92c09d8f679a1a0b026fb082a3f0b52e9f1cc60..2ec4dae0a0bad2bd0c10155630a4df351bb845dc 100644 --- a/src/sampling/sampledSurface/writers/proxy/proxySurfaceWriter.C +++ b/src/sampling/sampledSurface/writers/proxy/proxySurfaceWriter.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -60,8 +60,7 @@ Foam::fileName Foam::proxySurfaceWriter::write ( const fileName& outputDir, const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const bool verbose ) const { @@ -83,7 +82,7 @@ Foam::fileName Foam::proxySurfaceWriter::write Info<< "Writing geometry to " << outName << endl; } - MeshedSurfaceProxy<face>(points, faces).write(outName); + MeshedSurfaceProxy<face>(surf.points(), surf.faces()).write(outName); return outName; } diff --git a/src/sampling/sampledSurface/writers/proxy/proxySurfaceWriter.H b/src/sampling/sampledSurface/writers/proxy/proxySurfaceWriter.H index 3ace22ea84c06b5e054815c7d7abb956cf16e5c5..62ba62705ec09007a1fdccdf2b5279382041ee8d 100644 --- a/src/sampling/sampledSurface/writers/proxy/proxySurfaceWriter.H +++ b/src/sampling/sampledSurface/writers/proxy/proxySurfaceWriter.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -89,10 +89,9 @@ public: ( const fileName& outputDir, const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const bool verbose = false - ) const; + ) const; // override }; diff --git a/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.C b/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.C index b5e93dc6cbc20354bb2cf23bb676255cffa084e1..364b0a4270ebb6c2eb67031fdfff4dd275713be6 100644 --- a/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.C +++ b/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -40,11 +40,9 @@ namespace Foam inline void Foam::rawSurfaceWriter::writeLocation ( Ostream& os, - const pointField& points, - const label pointi + const point& pt ) { - const point& pt = points[pointi]; os << pt.x() << ' ' << pt.y() << ' ' << pt.z() << ' '; } @@ -53,12 +51,10 @@ inline void Foam::rawSurfaceWriter::writeLocation ( Ostream& os, const pointField& points, - const faceList& faces, - const label facei + const face& f ) { - const point& ct = faces[facei].centre(points); - os << ct.x() << ' ' << ct.y() << ' ' << ct.z() << ' '; + writeLocation(os, f.centre(points)); } @@ -238,11 +234,13 @@ Foam::fileName Foam::rawSurfaceWriter::write ( const fileName& outputDir, const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const bool verbose ) const { + const pointField& points = surf.points(); + const faceList& faces = surf.faces(); + if (!isDir(outputDir)) { mkDir(outputDir); @@ -269,7 +267,7 @@ Foam::fileName Foam::rawSurfaceWriter::write // Write faces centres forAll(faces, elemI) { - writeLocation(os, points, faces, elemI); + writeLocation(os, points, faces[elemI]); os << nl; } diff --git a/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.H b/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.H index a679251af41f2c33259e6d46278a481546bca3ac..986b588862796b877ec20bd8d8e80786ddaeba72 100644 --- a/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.H +++ b/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -59,19 +59,13 @@ class rawSurfaceWriter // Private Member Functions - static inline void writeLocation - ( - Ostream&, - const pointField&, - const label pointi - ); + static inline void writeLocation(Ostream&, const point&); static inline void writeLocation ( Ostream&, const pointField&, - const faceList&, - const label facei + const face& ); template<class Type> @@ -92,8 +86,7 @@ class rawSurfaceWriter ( const fileName& outputDir, const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, const Field<Type>& values, const bool isNodeValues, @@ -127,10 +120,9 @@ public: ( const fileName& outputDir, const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const bool verbose = false - ) const; + ) const; // override //- Write scalarField for a single surface to file. @@ -139,13 +131,12 @@ public: ( const fileName& outputDir, // <case>/surface/TIME const fileName& surfaceName, // name of surface - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, // name of field const Field<scalar>& values, const bool isNodeValues, const bool verbose = false - ) const; + ) const; // override //- Write vectorField for a single surface to file. // One value per face or vertex (isNodeValues = true) @@ -153,13 +144,12 @@ public: ( const fileName& outputDir, // <case>/surface/TIME const fileName& surfaceName, // name of surface - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, // name of field const Field<vector>& values, const bool isNodeValues, const bool verbose = false - ) const; + ) const; // override //- Write sphericalTensorField for a single surface to file. // One value per face or vertex (isNodeValues = true) @@ -167,13 +157,12 @@ public: ( const fileName& outputDir, // <case>/surface/TIME const fileName& surfaceName, // name of surface - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, // name of field const Field<sphericalTensor>& values, const bool isNodeValues, const bool verbose = false - ) const; + ) const; // override //- Write symmTensorField for a single surface to file. // One value per face or vertex (isNodeValues = true) @@ -181,13 +170,12 @@ public: ( const fileName& outputDir, // <case>/surface/TIME const fileName& surfaceName, // name of surface - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, // name of field const Field<symmTensor>& values, const bool isNodeValues, const bool verbose = false - ) const; + ) const; // override //- Write tensorField for a single surface to file. // One value per face or vertex (isNodeValues = true) @@ -195,13 +183,12 @@ public: ( const fileName& outputDir, // <case>/surface/TIME const fileName& surfaceName, // name of surface - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, // name of field const Field<tensor>& values, const bool isNodeValues, const bool verbose = false - ) const; + ) const; // override }; diff --git a/src/sampling/sampledSurface/writers/raw/rawSurfaceWriterTemplates.C b/src/sampling/sampledSurface/writers/raw/rawSurfaceWriterTemplates.C index 3341378838da7020dd62f4e445953d322ae859e8..bf0cb44f22f5a11c91edf21ee851a8a5fa8c7e89 100644 --- a/src/sampling/sampledSurface/writers/raw/rawSurfaceWriterTemplates.C +++ b/src/sampling/sampledSurface/writers/raw/rawSurfaceWriterTemplates.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -34,14 +34,16 @@ Foam::fileName Foam::rawSurfaceWriter::writeTemplate ( const fileName& outputDir, const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, const Field<Type>& values, const bool isNodeValues, const bool verbose ) const { + const pointField& points = surf.points(); + const faceList& faces = surf.faces(); + if (!isDir(outputDir)) { mkDir(outputDir); @@ -73,7 +75,7 @@ Foam::fileName Foam::rawSurfaceWriter::writeTemplate { forAll(values, elemI) { - writeLocation(os, points, elemI); + writeLocation(os, points[elemI]); writeData(os, values[elemI]); } } @@ -81,7 +83,7 @@ Foam::fileName Foam::rawSurfaceWriter::writeTemplate { forAll(values, elemI) { - writeLocation(os, points, faces, elemI); + writeLocation(os, points, faces[elemI]); writeData(os, values[elemI]); } } diff --git a/src/sampling/sampledSurface/writers/starcd/starcdSurfaceWriter.C b/src/sampling/sampledSurface/writers/starcd/starcdSurfaceWriter.C index 2b58417a5bf0f8b9e11455cb278375c80f274518..3f79e3891c106d4d53948c9ca689bbe9050e0ada 100644 --- a/src/sampling/sampledSurface/writers/starcd/starcdSurfaceWriter.C +++ b/src/sampling/sampledSurface/writers/starcd/starcdSurfaceWriter.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -94,8 +94,7 @@ Foam::fileName Foam::starcdSurfaceWriter::write ( const fileName& outputDir, const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const bool verbose ) const { @@ -111,7 +110,7 @@ Foam::fileName Foam::starcdSurfaceWriter::write Info<< "Writing geometry to " << outName << endl; } - MeshedSurfaceProxy<face>(points, faces).write(outName); + MeshedSurfaceProxy<face>(surf.points(), surf.faces()).write(outName); return outName; } diff --git a/src/sampling/sampledSurface/writers/starcd/starcdSurfaceWriter.H b/src/sampling/sampledSurface/writers/starcd/starcdSurfaceWriter.H index aeaed7d30b7780614ed42e6003620956fb50e0ab..d5a9d87552623485217700aa0b18a9e640601dcd 100644 --- a/src/sampling/sampledSurface/writers/starcd/starcdSurfaceWriter.H +++ b/src/sampling/sampledSurface/writers/starcd/starcdSurfaceWriter.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -81,8 +81,7 @@ class starcdSurfaceWriter ( const fileName& outputDir, const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, const Field<Type>& values, const bool isNodeValues, @@ -119,11 +118,10 @@ public: virtual fileName write ( const fileName& outputDir, - const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const fileName& surfaceName, // name of surface + const meshedSurf& surf, const bool verbose = false - ) const; + ) const; // override //- Write scalarField for a single surface to file. // One value per face or vertex (isNodeValues = true) @@ -131,13 +129,12 @@ public: ( const fileName& outputDir, // <case>/surface/TIME const fileName& surfaceName, // name of surface - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, // name of field const Field<scalar>& values, const bool isNodeValues, const bool verbose = false - ) const; + ) const; // override //- Write vectorField for a single surface to file. // One value per face or vertex (isNodeValues = true) @@ -145,13 +142,12 @@ public: ( const fileName& outputDir, // <case>/surface/TIME const fileName& surfaceName, // name of surface - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, // name of field const Field<vector>& values, const bool isNodeValues, const bool verbose = false - ) const; + ) const; // override //- Write sphericalTensorField for a single surface to file. // One value per face or vertex (isNodeValues = true) @@ -159,13 +155,12 @@ public: ( const fileName& outputDir, // <case>/surface/TIME const fileName& surfaceName, // name of surface - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, // name of field const Field<sphericalTensor>& values, const bool isNodeValues, const bool verbose = false - ) const; + ) const; // override }; diff --git a/src/sampling/sampledSurface/writers/starcd/starcdSurfaceWriterTemplates.C b/src/sampling/sampledSurface/writers/starcd/starcdSurfaceWriterTemplates.C index 026b5b7425a14112fac988efd04ac0242f9db843..d14b3da6fbe570912e50c14d76e2d914196f9c49 100644 --- a/src/sampling/sampledSurface/writers/starcd/starcdSurfaceWriterTemplates.C +++ b/src/sampling/sampledSurface/writers/starcd/starcdSurfaceWriterTemplates.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -42,8 +42,7 @@ Foam::fileName Foam::starcdSurfaceWriter::writeTemplate ( const fileName& outputDir, const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const meshedSurf&, const word& fieldName, const Field<Type>& values, const bool isNodeValues, diff --git a/src/sampling/sampledSurface/writers/surfaceWriter.H b/src/sampling/sampledSurface/writers/surfaceWriter.H index bd4c40420353f43376801e3913f8e3cb085d3975..a640fb5a053b0bf3504933fbecbb75e671716e71 100644 --- a/src/sampling/sampledSurface/writers/surfaceWriter.H +++ b/src/sampling/sampledSurface/writers/surfaceWriter.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -37,10 +37,8 @@ SourceFiles #include "typeInfo.H" #include "autoPtr.H" -#include "pointField.H" -#include "faceList.H" #include "fileName.H" - +#include "meshedSurfRef.H" #include "runTimeSelectionTables.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -120,8 +118,7 @@ public: ( const fileName& outputDir, // <case>/surface/TIME const fileName& surfaceName, // name of surface - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const bool verbose = false ) const { @@ -134,8 +131,7 @@ public: ( const fileName& outputDir, // <case>/surface/TIME const fileName& surfaceName, // name of surface - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, // name of field const Field<scalar>& values, const bool isNodeValues, @@ -151,8 +147,7 @@ public: ( const fileName& outputDir, // <case>/surface/TIME const fileName& surfaceName, // name of surface - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, // name of field const Field<vector>& values, const bool isNodeValues, @@ -168,8 +163,7 @@ public: ( const fileName& outputDir, // <case>/surface/TIME const fileName& surfaceName, // name of surface - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, // name of field const Field<sphericalTensor>& values, const bool isNodeValues, @@ -185,8 +179,7 @@ public: ( const fileName& outputDir, // <case>/surface/TIME const fileName& surfaceName, // name of surface - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, // name of field const Field<symmTensor>& values, const bool isNodeValues, @@ -202,8 +195,7 @@ public: ( const fileName& outputDir, // <case>/surface/TIME const fileName& surfaceName, // name of surface - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, // name of field const Field<tensor>& values, const bool isNodeValues, diff --git a/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriter.C b/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriter.C index f7d8c0fd69a626f9abbd6de4d3507540e1649c0c..9b4c28c1ed0e5dee6d9908e24347d0b9c00196f8 100644 --- a/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriter.C +++ b/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriter.C @@ -40,10 +40,12 @@ namespace Foam void Foam::vtkSurfaceWriter::writeGeometry ( Ostream& os, - const pointField& points, - const faceList& faces + const meshedSurf& surf ) { + const pointField& points = surf.points(); + const faceList& faces = surf.faces(); + // header os << "# vtk DataFile Version 2.0" << nl @@ -131,8 +133,9 @@ namespace Foam forAll(values, elemI) { const vector& v = values[elemI]; - os << float(v[0]) << ' ' << float(v[1]) << ' ' << float(v[2]) - << nl; + os << float(v[0]) << ' ' + << float(v[1]) << ' ' + << float(v[2]) << nl; } } @@ -234,8 +237,7 @@ Foam::fileName Foam::vtkSurfaceWriter::write ( const fileName& outputDir, const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const bool verbose ) const { @@ -252,7 +254,7 @@ Foam::fileName Foam::vtkSurfaceWriter::write Info<< "Writing geometry to " << os.name() << endl; } - writeGeometry(os, points, faces); + writeGeometry(os, surf); return os.name(); } diff --git a/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriter.H b/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriter.H index f3d17fc2b9950fda4ec4196ee8f36339aaf54d74..85ab3026e914a09db083f23aa60ad62a33181544 100644 --- a/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriter.H +++ b/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriter.H @@ -57,7 +57,7 @@ class vtkSurfaceWriter // Private Member Functions - static void writeGeometry(Ostream&, const pointField&, const faceList&); + static void writeGeometry(Ostream&, const meshedSurf&); template<class Type> static void writeData(Ostream&, const Field<Type>&); @@ -69,8 +69,7 @@ class vtkSurfaceWriter ( const fileName& outputDir, const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, const Field<Type>& values, const bool isNodeValues, @@ -104,10 +103,9 @@ public: ( const fileName& outputDir, const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const bool verbose = false - ) const; + ) const; // override //- Write scalarField for a single surface to file. @@ -116,13 +114,12 @@ public: ( const fileName& outputDir, // <case>/surface/TIME const fileName& surfaceName, // name of surface - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, // name of field const Field<scalar>& values, const bool isNodeValues, const bool verbose = false - ) const; + ) const; // override //- Write vectorField for a single surface to file. // One value per face or vertex (isNodeValues = true) @@ -130,13 +127,12 @@ public: ( const fileName& outputDir, // <case>/surface/TIME const fileName& surfaceName, // name of surface - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, // name of field const Field<vector>& values, const bool isNodeValues, const bool verbose = false - ) const; + ) const; // override //- Write sphericalTensorField for a single surface to file. // One value per face or vertex (isNodeValues = true) @@ -144,13 +140,12 @@ public: ( const fileName& outputDir, // <case>/surface/TIME const fileName& surfaceName, // name of surface - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, // name of field const Field<sphericalTensor>& values, const bool isNodeValues, const bool verbose = false - ) const; + ) const; // override //- Write symmTensorField for a single surface to file. // One value per face or vertex (isNodeValues = true) @@ -158,13 +153,12 @@ public: ( const fileName& outputDir, // <case>/surface/TIME const fileName& surfaceName, // name of surface - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, // name of field const Field<symmTensor>& values, const bool isNodeValues, const bool verbose = false - ) const; + ) const; // override //- Write tensorField for a single surface to file. // One value per face or vertex (isNodeValues = true) @@ -172,13 +166,12 @@ public: ( const fileName& outputDir, // <case>/surface/TIME const fileName& surfaceName, // name of surface - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, // name of field const Field<tensor>& values, const bool isNodeValues, const bool verbose = false - ) const; + ) const; // override }; diff --git a/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriterTemplates.C b/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriterTemplates.C index 6ceb45e464395ca1385c317033dfde79abe16c0e..ee7c129d520ca17c21773ce43655f6ae6f6df156 100644 --- a/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriterTemplates.C +++ b/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriterTemplates.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -49,8 +49,7 @@ Foam::fileName Foam::vtkSurfaceWriter::writeTemplate ( const fileName& outputDir, const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, const Field<Type>& values, const bool isNodeValues, @@ -70,7 +69,7 @@ Foam::fileName Foam::vtkSurfaceWriter::writeTemplate Info<< "Writing field " << fieldName << " to " << os.name() << endl; } - writeGeometry(os, points, faces); + writeGeometry(os, surf); // start writing data if (isNodeValues) diff --git a/src/surfMesh/Make/files b/src/surfMesh/Make/files index f86024310449ba7bf2207d713c716b92fd4cb7e0..5e19af861366c32dac7299078654198d27636264 100644 --- a/src/surfMesh/Make/files +++ b/src/surfMesh/Make/files @@ -10,6 +10,8 @@ UnsortedMeshedSurface/UnsortedMeshedSurfaces.C MeshedSurfaceProxy/MeshedSurfaceProxyCore.C +mergedSurf/mergedSurf.C + surfaceRegistry/surfaceRegistry.C surfMesh/surfMesh.C surfMesh/surfMeshClear.C diff --git a/src/surfMesh/MeshedSurface/MeshedSurface.C b/src/surfMesh/MeshedSurface/MeshedSurface.C index e6cd3985057e3ef740e201062992f30dcb624db5..0bc6e4921c4d26da43476bc586f8a9fd1d7b2026 100644 --- a/src/surfMesh/MeshedSurface/MeshedSurface.C +++ b/src/surfMesh/MeshedSurface/MeshedSurface.C @@ -209,7 +209,7 @@ Foam::MeshedSurface<Face>::MeshedSurface const MeshedSurface<Face>& surf ) : - ParentType(surf.faces(), surf.points()), + ParentType(surf.surfFaces(), surf.points()), zones_(surf.surfZones()) {} @@ -225,7 +225,7 @@ Foam::MeshedSurface<Face>::MeshedSurface labelList faceMap; this->storedZones() = surf.sortedZones(faceMap); - const List<Face>& origFaces = surf.faces(); + const List<Face>& origFaces = surf; List<Face> newFaces(origFaces.size()); forAll(newFaces, facei) @@ -1167,7 +1167,7 @@ void Foam::MeshedSurface<Face>::operator=(const MeshedSurface& surf) clear(); this->storedPoints() = surf.points(); - this->storedFaces() = surf.faces(); + this->storedFaces() = surf.surfFaces(); this->storedZones() = surf.surfZones(); } @@ -1178,7 +1178,7 @@ Foam::MeshedSurface<Face>::operator Foam::MeshedSurfaceProxy<Face>() const return MeshedSurfaceProxy<Face> ( this->points(), - this->faces(), + this->surfFaces(), this->surfZones() ); } diff --git a/src/surfMesh/MeshedSurface/MeshedSurface.H b/src/surfMesh/MeshedSurface/MeshedSurface.H index 9f3a34a80a012d4bdcd5ebb1787bd54b011a6a43..3ff8eb73b410b52895587aadd9dfc6de13eac81e 100644 --- a/src/surfMesh/MeshedSurface/MeshedSurface.H +++ b/src/surfMesh/MeshedSurface/MeshedSurface.H @@ -326,7 +326,7 @@ public: } //- Return const access to the faces - inline const List<Face>& faces() const + inline const List<Face>& surfFaces() const { return static_cast<const List<Face>&>(*this); } diff --git a/src/surfMesh/MeshedSurface/MeshedSurfaceIO.C b/src/surfMesh/MeshedSurface/MeshedSurfaceIO.C index 89204c063b852e033b7c7a940f82af18da09e740..9d8c5dd0912b8c9259657d5a936a5d9b225c3330 100644 --- a/src/surfMesh/MeshedSurface/MeshedSurfaceIO.C +++ b/src/surfMesh/MeshedSurface/MeshedSurfaceIO.C @@ -47,7 +47,7 @@ Foam::Ostream& Foam::MeshedSurface<Face>::write(Ostream& os) const { os << this->surfZones() << this->points() - << this->faces(); + << this->surfFaces(); os.check("MeshedSurface::write(Ostream&) const"); return os; diff --git a/src/surfMesh/MeshedSurfaceAllocator/MeshedSurfaceIOAllocator.H b/src/surfMesh/MeshedSurfaceAllocator/MeshedSurfaceIOAllocator.H index 0e9d481cb494b9b16efb0bc3b134ed97e9f36ffd..190b081ce5ab1a6ac1f4f48caf0a450485ad7179 100644 --- a/src/surfMesh/MeshedSurfaceAllocator/MeshedSurfaceIOAllocator.H +++ b/src/surfMesh/MeshedSurfaceAllocator/MeshedSurfaceIOAllocator.H @@ -65,10 +65,10 @@ class MeshedSurfaceIOAllocator // Private Member Functions //- Disallow default bitwise copy construct - MeshedSurfaceIOAllocator(const MeshedSurfaceIOAllocator&); + MeshedSurfaceIOAllocator(const MeshedSurfaceIOAllocator&) = delete; //- Disallow default bitwise assignment - void operator=(const MeshedSurfaceIOAllocator&); + void operator=(const MeshedSurfaceIOAllocator&) = delete; public: diff --git a/src/surfMesh/MeshedSurfaceProxy/MeshedSurfaceProxy.C b/src/surfMesh/MeshedSurfaceProxy/MeshedSurfaceProxy.C index 4b8a754bcaa66afb1696f4e2b1cab24c845fdd6d..1b1ad73ccf73a98099ec7527d4a9e21edef022ce 100644 --- a/src/surfMesh/MeshedSurfaceProxy/MeshedSurfaceProxy.C +++ b/src/surfMesh/MeshedSurfaceProxy/MeshedSurfaceProxy.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -171,11 +171,11 @@ void Foam::MeshedSurfaceProxy<Face>::write if (this->useFaceMap()) { // this is really a bit annoying (and wasteful) but no other way - os << reorder(this->faceMap(), this->faces()); + os << reorder(this->faceMap(), this->surfFaces()); } else { - os << this->faces(); + os << this->surfFaces(); } io.writeEndDivider(os); diff --git a/src/surfMesh/MeshedSurfaceProxy/MeshedSurfaceProxy.H b/src/surfMesh/MeshedSurfaceProxy/MeshedSurfaceProxy.H index 9338f7dd68cc9f1619d2d5970ec0066cbef6a489..9dc548aba459ca4494a7f8db33591c01627118a9 100644 --- a/src/surfMesh/MeshedSurfaceProxy/MeshedSurfaceProxy.H +++ b/src/surfMesh/MeshedSurfaceProxy/MeshedSurfaceProxy.H @@ -146,7 +146,7 @@ public: } //- Return const access to the faces - inline const List<Face>& faces() const + inline const List<Face>& surfFaces() const { return faces_; } diff --git a/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.C b/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.C index 2848beafc0a2a6ab2b24d191f0a71ef7437874ae..d427454e4ac34ddd5bf506b1d8d8c1f513dd5625 100644 --- a/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.C +++ b/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.C @@ -202,7 +202,7 @@ Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface ParentType ( xferCopy(surf.points()), - xferCopy(surf.faces()) + xferCopy(surf.surfFaces()) ), zoneIds_(surf.zoneIds()), zoneToc_(surf.zoneToc()) @@ -218,7 +218,7 @@ Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface ParentType ( xferCopy(surf.points()), - xferCopy(surf.faces()) + xferCopy(surf.surfFaces()) ) { setZones(surf.surfZones()); @@ -456,7 +456,7 @@ Foam::Ostream& Foam::UnsortedMeshedSurface<Face>::write(Ostream& os) const { os << this->zoneIds() << this->points() - << this->faces(); + << this->surfFaces(); os.check("UnsortedMeshedSurface::write(Ostream&) const"); return os; @@ -777,7 +777,7 @@ void Foam::UnsortedMeshedSurface<Face>::operator= clear(); this->storedPoints() = surf.points(); - this->storedFaces() = surf.faces(); + this->storedFaces() = surf.surfFaces(); zoneIds_ = surf.zoneIds_; zoneToc_ = surf.zoneToc_; } @@ -793,7 +793,7 @@ Foam::MeshedSurfaceProxy<Face>() const return MeshedSurfaceProxy<Face> ( this->points(), - this->faces(), + this->surfFaces(), zoneLst, faceMap ); diff --git a/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.H b/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.H index b50460a45d25a61f39cb9c00c5d3ed295e868dca..68a78888d4e6d623c2e179a4fd00f79a66026991 100644 --- a/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.H +++ b/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.H @@ -126,7 +126,7 @@ protected: // Protected Member functions //- Return non-const access to the zone Ids - List<label>& storedZoneIds() + labelList& storedZoneIds() { return zoneIds_; } @@ -289,7 +289,7 @@ public: void setSize(const label); //- Return const access to the zone ids - const List<label>& zoneIds() const + virtual const labelList& zoneIds() const { return zoneIds_; } diff --git a/src/surfMesh/mergedSurf/mergedSurf.C b/src/surfMesh/mergedSurf/mergedSurf.C new file mode 100644 index 0000000000000000000000000000000000000000..d5c5f3dc8e8ab835ae861c899e0da54ca7c8419a --- /dev/null +++ b/src/surfMesh/mergedSurf/mergedSurf.C @@ -0,0 +1,122 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "mergedSurf.H" +#include "PatchTools.H" +#include "ListListOps.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::mergedSurf::mergedSurf() +: + points_(), + faces_(), + zones_(), + pointsMap_() +{} + + +Foam::mergedSurf::mergedSurf +( + const meshedSurf& surf, + const scalar mergeDim +) +: + mergedSurf() +{ + merge(surf, mergeDim); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::mergedSurf::~mergedSurf() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::mergedSurf::use() +{ + return Pstream::parRun(); +} + + +void Foam::mergedSurf::clear() +{ + points_.clear(); + faces_.clear(); + zones_.clear(); + pointsMap_.clear(); +} + + +bool Foam::mergedSurf::merge +( + const meshedSurf& surf, + const scalar mergeDim +) +{ + // needed for extra safety? + // clear(); + + if (!use()) + { + return false; + } + + PatchTools::gatherAndMerge + ( + mergeDim, + primitivePatch + ( + SubList<face>(surf.faces(), surf.faces().size()), + surf.points() + ), + points_, + faces_, + pointsMap_ + ); + + // Now handle zone/region information + List<labelList> allZones(Pstream::nProcs()); + allZones[Pstream::myProcNo()] = surf.zoneIds(); + Pstream::gatherList(allZones); + + if (Pstream::master()) + { + zones_ = ListListOps::combine<labelList> + ( + allZones, + accessOp<labelList>() + ); + } + allZones.clear(); + + return true; +} + + +// ************************************************************************* // diff --git a/src/surfMesh/mergedSurf/mergedSurf.H b/src/surfMesh/mergedSurf/mergedSurf.H new file mode 100644 index 0000000000000000000000000000000000000000..dae03660ee95fcf6797b986d75a6e2f989d71387 --- /dev/null +++ b/src/surfMesh/mergedSurf/mergedSurf.H @@ -0,0 +1,133 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::mergedSurf + +Description + Simple class to manage surface merging information + +SourceFiles + mergedSurf.C + +\*---------------------------------------------------------------------------*/ + +#ifndef mergedSurf_H +#define mergedSurf_H + +#include "meshedSurf.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class mergedSurf Declaration +\*---------------------------------------------------------------------------*/ + +class mergedSurf +: + public meshedSurf +{ + pointField points_; + faceList faces_; + labelList zones_; + labelList pointsMap_; + + //- Disallow default bitwise copy construct + mergedSurf(const mergedSurf&) = delete; + + // Assignment is needed for lists + +public: + + // Constructors + + //- Construct null + mergedSurf(); + + //- Construct and merge meshed surfaces immediately (in parallel only). + mergedSurf(const meshedSurf&, const scalar mergeDim); + + + //- Destructor + virtual ~mergedSurf(); + + + // Access Member Functions + + //- Can use (parallel only) + static bool use(); + + //- Number of faces + label size() const + { + return faces_.size(); + } + + //- Const access to (global) points used for the surface + virtual const pointField& points() const + { + return points_; + } + + //- Const access to the surface faces + virtual const faceList& faces() const + { + return faces_; + } + + //- Const access to per-face zone/region information + virtual const labelList& zoneIds() const + { + return zones_; + } + + //- Map for reordered points (old-to-new) + const labelList& pointsMap() const + { + return pointsMap_; + } + + + // Edit + + //- Clear all storage + void clear(); + + //- Merge meshed surfaces (in parallel only). + bool merge(const meshedSurf&, const scalar mergeDim); + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/surfMesh/meshedSurf/meshedSurf.H b/src/surfMesh/meshedSurf/meshedSurf.H new file mode 100644 index 0000000000000000000000000000000000000000..0d7281be04c55c37a83d5a1749bb9019f469c508 --- /dev/null +++ b/src/surfMesh/meshedSurf/meshedSurf.H @@ -0,0 +1,85 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::meshedSurf + +Description + Abstract definition of a meshed surface defined by faces and points. + +\*---------------------------------------------------------------------------*/ + +#ifndef meshedSurf_H +#define meshedSurf_H + +#include "pointField.H" +#include "faceList.H" +#include "ListOps.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class meshedSurf Declaration +\*---------------------------------------------------------------------------*/ + +class meshedSurf +{ +public: + + // Constructors + + //- Construct null + meshedSurf() + {} + + + //- Destructor + virtual ~meshedSurf() + {} + + + // Access Member Functions + + //- Const access to (global) points used for the surface + virtual const pointField& points() const = 0; + + //- Const access to the surface faces + virtual const faceList& faces() const = 0; + + //- Const access to per-face zone/region information + virtual const labelList& zoneIds() const = 0; + +}; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/surfMesh/meshedSurf/meshedSurfRef.H b/src/surfMesh/meshedSurf/meshedSurfRef.H new file mode 100644 index 0000000000000000000000000000000000000000..8390795fb69b2cf86ecb85377a534210ff281cfc --- /dev/null +++ b/src/surfMesh/meshedSurf/meshedSurfRef.H @@ -0,0 +1,119 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::meshedSurfRef + +Description + Implements a meshed surface by referencing existing faces and points. + +\*---------------------------------------------------------------------------*/ + +#ifndef meshedSurfRef_H +#define meshedSurfRef_H + +#include "meshedSurf.H" +#include "labelList.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class meshedSurfRef Declaration +\*---------------------------------------------------------------------------*/ + +class meshedSurfRef +: + public meshedSurf +{ + const pointField& points_; + const faceList& faces_; + const labelList& zoneIds_; + + + // Private Member Functions + + //- Disallow construct as copy + meshedSurfRef(const meshedSurfRef&) = delete; + + //- Disallow default bitwise assignment + void operator=(const meshedSurfRef&) = delete; + +public: + + // Public Member Functions + + // Constructors + + //- Construct from components + meshedSurfRef + ( + const pointField& pts, + const faceList& faces, + const labelList& ids = Foam::emptyLabelList + ) + : + points_(pts), + faces_(faces), + zoneIds_(ids) + {} + + + //- Destructor + virtual ~meshedSurfRef() + {} + + + // Access Member Functions + + //- Const access to (global) points used for the surface + virtual const pointField& points() const + { + return points_; + } + + //- Const access to the surface faces + virtual const faceList& faces() const + { + return faces_; + } + + //- Const access to per-face zone/region information + virtual const labelList& zoneIds() const + { + return zoneIds_; + } + +}; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/surfMesh/surfaceFormats/ac3d/AC3DsurfaceFormat.C b/src/surfMesh/surfaceFormats/ac3d/AC3DsurfaceFormat.C index d589c9a79e8164bfff5f7e6b3b5892c6a6a127ea..c88b4ed5b0523f9dd298aec30dbb9a4c6e4968a4 100644 --- a/src/surfMesh/surfaceFormats/ac3d/AC3DsurfaceFormat.C +++ b/src/surfMesh/surfaceFormats/ac3d/AC3DsurfaceFormat.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -261,7 +261,7 @@ void Foam::fileFormats::AC3DsurfaceFormat<Face>::write ) { const pointField& pointLst = surf.points(); - const List<Face>& faceLst = surf.faces(); + const List<Face>& faceLst = surf.surfFaces(); const List<surfZone>& zones = ( @@ -358,7 +358,7 @@ void Foam::fileFormats::AC3DsurfaceFormat<Face>::write MeshedSurfaceProxy<Face> ( surf.points(), - surf.faces(), + surf.surfFaces(), zoneLst ) ); diff --git a/src/surfMesh/surfaceFormats/gts/GTSsurfaceFormat.C b/src/surfMesh/surfaceFormats/gts/GTSsurfaceFormat.C index 9d9f3c5f0b60ec712a614255a704baba041b2c96..069c0b9db2009f107f259f19ef5bffbaa9df355b 100644 --- a/src/surfMesh/surfaceFormats/gts/GTSsurfaceFormat.C +++ b/src/surfMesh/surfaceFormats/gts/GTSsurfaceFormat.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -216,7 +216,7 @@ void Foam::fileFormats::GTSsurfaceFormat<Face>::write ) { const pointField& pointLst = surf.points(); - const List<Face>& faceLst = surf.faces(); + const List<Face>& faceLst = surf.surfFaces(); const List<surfZone>& zones = ( @@ -323,7 +323,7 @@ void Foam::fileFormats::GTSsurfaceFormat<Face>::write ) { const pointField& pointLst = surf.points(); - const List<Face>& faceLst = surf.faces(); + const List<Face>& faceLst = surf.surfFaces(); const List<label>& zoneIds = surf.zoneIds(); const List<surfZoneIdentifier>& zoneToc = surf.zoneToc(); diff --git a/src/surfMesh/surfaceFormats/obj/OBJsurfaceFormat.C b/src/surfMesh/surfaceFormats/obj/OBJsurfaceFormat.C index 7a4eacde00b5ea6c7e7f399007aa68efe1fa8d25..2107d02a5f61688648ea87dbd02433696f335cb3 100644 --- a/src/surfMesh/surfaceFormats/obj/OBJsurfaceFormat.C +++ b/src/surfMesh/surfaceFormats/obj/OBJsurfaceFormat.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -215,7 +215,7 @@ void Foam::fileFormats::OBJsurfaceFormat<Face>::write ) { const pointField& pointLst = surf.points(); - const List<Face>& faceLst = surf.faces(); + const List<Face>& faceLst = surf.surfFaces(); const List<label>& faceMap = surf.faceMap(); // for no zones, suppress the group name diff --git a/src/surfMesh/surfaceFormats/off/OFFsurfaceFormat.C b/src/surfMesh/surfaceFormats/off/OFFsurfaceFormat.C index 86e8220c6aa8ab1a684b61aa28971b5d0612b9cc..b4cb06a81fc88ba2f8a2f6f36978dcbf8e7a914a 100644 --- a/src/surfMesh/surfaceFormats/off/OFFsurfaceFormat.C +++ b/src/surfMesh/surfaceFormats/off/OFFsurfaceFormat.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -149,7 +149,7 @@ void Foam::fileFormats::OFFsurfaceFormat<Face>::write ) { const pointField& pointLst = surf.points(); - const List<Face>& faceLst = surf.faces(); + const List<Face>& faceLst = surf.surfFaces(); const List<label>& faceMap = surf.faceMap(); const List<surfZone>& zoneLst = surf.surfZones(); diff --git a/src/surfMesh/surfaceFormats/ofs/OFSsurfaceFormat.C b/src/surfMesh/surfaceFormats/ofs/OFSsurfaceFormat.C index 6f9d2595f7068bf8402c24c9c26b07aff59e30f4..203a4653c73a9c547ec13d90f1880bb1ecbe2c96 100644 --- a/src/surfMesh/surfaceFormats/ofs/OFSsurfaceFormat.C +++ b/src/surfMesh/surfaceFormats/ofs/OFSsurfaceFormat.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -193,7 +193,7 @@ void Foam::fileFormats::OFSsurfaceFormat<Face>::write const MeshedSurfaceProxy<Face>& surf ) { - const List<Face>& faceLst = surf.faces(); + const List<Face>& faceLst = surf.surfFaces(); const List<label>& faceMap = surf.faceMap(); OFstream os(filename); diff --git a/src/surfMesh/surfaceFormats/smesh/SMESHsurfaceFormat.C b/src/surfMesh/surfaceFormats/smesh/SMESHsurfaceFormat.C index 2530cf8ed491c97ad66ee079d6a30f2e1c0a8730..e8e7ed21cc5a5636db3242951fc4e78b7724480d 100644 --- a/src/surfMesh/surfaceFormats/smesh/SMESHsurfaceFormat.C +++ b/src/surfMesh/surfaceFormats/smesh/SMESHsurfaceFormat.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -46,7 +46,7 @@ void Foam::fileFormats::SMESHsurfaceFormat<Face>::write ) { const pointField& pointLst = surf.points(); - const List<Face>& faceLst = surf.faces(); + const List<Face>& faceLst = surf.surfFaces(); const List<label>& faceMap = surf.faceMap(); const List<surfZone>& zones = diff --git a/src/surfMesh/surfaceFormats/starcd/STARCDsurfaceFormat.C b/src/surfMesh/surfaceFormats/starcd/STARCDsurfaceFormat.C index 4ddd88c404d034fc420fece87c3a060aa0cb759a..c4ef94cb383e040490dd58c0b91f8231a2fe2b91 100644 --- a/src/surfMesh/surfaceFormats/starcd/STARCDsurfaceFormat.C +++ b/src/surfMesh/surfaceFormats/starcd/STARCDsurfaceFormat.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -247,7 +247,7 @@ void Foam::fileFormats::STARCDsurfaceFormat<Face>::write ) { const pointField& pointLst = surf.points(); - const List<Face>& faceLst = surf.faces(); + const List<Face>& faceLst = surf.surfFaces(); const List<label>& faceMap = surf.faceMap(); const List<surfZone>& zones = diff --git a/src/surfMesh/surfaceFormats/stl/STLsurfaceFormat.C b/src/surfMesh/surfaceFormats/stl/STLsurfaceFormat.C index e3c53dabcc45fb255d60f7c257e7e24e651d5ff9..17dcb781f4d77c40127766a03ae304b49284a167 100644 --- a/src/surfMesh/surfaceFormats/stl/STLsurfaceFormat.C +++ b/src/surfMesh/surfaceFormats/stl/STLsurfaceFormat.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -203,7 +203,7 @@ void Foam::fileFormats::STLsurfaceFormat<Face>::writeAscii } const pointField& pointLst = surf.points(); - const List<Face>& faceLst = surf.faces(); + const List<Face>& faceLst = surf.surfFaces(); const List<label>& faceMap = surf.faceMap(); const List<surfZone>& zones = @@ -258,9 +258,8 @@ void Foam::fileFormats::STLsurfaceFormat<Face>::writeBinary << exit(FatalError); } - const pointField& pointLst = surf.points(); - const List<Face>& faceLst = surf.faces(); + const List<Face>& faceLst = surf.surfFaces(); const List<label>& faceMap = surf.faceMap(); const List<surfZone>& zones = @@ -340,12 +339,12 @@ void Foam::fileFormats::STLsurfaceFormat<Face>::writeAscii << exit(FatalError); } + const pointField& pointLst = surf.points(); + const List<Face>& faceLst = surf.surfFaces(); + // a single zone - we can skip sorting if (surf.zoneToc().size() == 1) { - const pointField& pointLst = surf.points(); - const List<Face>& faceLst = surf.faces(); - os << "solid " << surf.zoneToc()[0].name() << endl; forAll(faceLst, facei) { @@ -363,8 +362,8 @@ void Foam::fileFormats::STLsurfaceFormat<Face>::writeAscii filename, MeshedSurfaceProxy<Face> ( - surf.points(), - surf.faces(), + pointLst, + faceLst, zoneLst, faceMap ) @@ -389,7 +388,7 @@ void Foam::fileFormats::STLsurfaceFormat<Face>::writeBinary } const pointField& pointLst = surf.points(); - const List<Face>& faceLst = surf.faces(); + const List<Face>& faceLst = surf.surfFaces(); const List<label>& zoneIds = surf.zoneIds(); unsigned int nTris = 0; diff --git a/src/surfMesh/surfaceFormats/tri/TRIsurfaceFormat.C b/src/surfMesh/surfaceFormats/tri/TRIsurfaceFormat.C index b95f2605be1d39b6126ce2891c560008667ab968..4261afacf154e59705920a59f90246fff8eb4f4d 100644 --- a/src/surfMesh/surfaceFormats/tri/TRIsurfaceFormat.C +++ b/src/surfMesh/surfaceFormats/tri/TRIsurfaceFormat.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -133,7 +133,7 @@ void Foam::fileFormats::TRIsurfaceFormat<Face>::write ) { const pointField& pointLst = surf.points(); - const List<Face>& faceLst = surf.faces(); + const List<Face>& faceLst = surf.surfFaces(); const List<label>& faceMap = surf.faceMap(); const List<surfZone>& zones = @@ -186,7 +186,7 @@ void Foam::fileFormats::TRIsurfaceFormat<Face>::write ) { const pointField& pointLst = surf.points(); - const List<Face>& faceLst = surf.faces(); + const List<Face>& faceLst = surf.surfFaces(); OFstream os(filename); if (!os.good()) diff --git a/src/surfMesh/surfaceFormats/vtk/VTKsurfaceFormat.C b/src/surfMesh/surfaceFormats/vtk/VTKsurfaceFormat.C index f5e5a889204cb48ecd0c3082f9701c1690d6b22b..a738dc53df998d524999a06b657738dd4007e10a 100644 --- a/src/surfMesh/surfaceFormats/vtk/VTKsurfaceFormat.C +++ b/src/surfMesh/surfaceFormats/vtk/VTKsurfaceFormat.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -223,7 +223,7 @@ void Foam::fileFormats::VTKsurfaceFormat<Face>::write ) { const pointField& pointLst = surf.points(); - const List<Face>& faceLst = surf.faces(); + const List<Face>& faceLst = surf.surfFaces(); const List<label>& faceMap = surf.faceMap(); const List<surfZone>& zones = @@ -302,7 +302,7 @@ void Foam::fileFormats::VTKsurfaceFormat<Face>::write } - const List<Face>& faceLst = surf.faces(); + const List<Face>& faceLst = surf.surfFaces(); writeHeader(os, surf.points()); writeHeaderPolygons(os, faceLst); diff --git a/src/surfMesh/surfaceFormats/wrl/WRLsurfaceFormat.C b/src/surfMesh/surfaceFormats/wrl/WRLsurfaceFormat.C index e3d44d8281b1ee1de87eee3762cc22b17e8322f0..ad67a0a3e26aea8a97af7a821c6338a19435b882 100644 --- a/src/surfMesh/surfaceFormats/wrl/WRLsurfaceFormat.C +++ b/src/surfMesh/surfaceFormats/wrl/WRLsurfaceFormat.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -46,7 +46,7 @@ void Foam::fileFormats::WRLsurfaceFormat<Face>::write ) { const pointField& pointLst = surf.points(); - const List<Face>& faceLst = surf.faces(); + const List<Face>& faceLst = surf.surfFaces(); const List<label>& faceMap = surf.faceMap(); // for no zones, suppress the group name diff --git a/src/surfMesh/surfaceFormats/x3d/X3DsurfaceFormat.C b/src/surfMesh/surfaceFormats/x3d/X3DsurfaceFormat.C index 2c296d6ab7ca51b8cc6c30e51b745c283c128d6c..89f051eae8eb6d5172ec507cd20053ad09377b2d 100644 --- a/src/surfMesh/surfaceFormats/x3d/X3DsurfaceFormat.C +++ b/src/surfMesh/surfaceFormats/x3d/X3DsurfaceFormat.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -48,7 +48,7 @@ void Foam::fileFormats::X3DsurfaceFormat<Face>::write ) { const pointField& pointLst = surf.points(); - const List<Face>& faceLst = surf.faces(); + const List<Face>& faceLst = surf.surfFaces(); const List<label>& faceMap = surf.faceMap(); // for no zones, suppress the group name diff --git a/src/triSurface/Make/options b/src/triSurface/Make/options index 9ee5884e5908ccdb6b1ba3acf323b8c524ec996a..210c65589602fc5911b063e86e95879380069bc9 100644 --- a/src/triSurface/Make/options +++ b/src/triSurface/Make/options @@ -3,5 +3,4 @@ EXE_INC = \ -I$(LIB_SRC)/surfMesh/lnInclude LIB_LIBS = \ - -lfileFormats \ -lsurfMesh diff --git a/src/triSurface/triSurface/interfaces/VTK/readVTK.C b/src/triSurface/triSurface/interfaces/VTK/readVTK.C index f4f026979c4e5d7dd5f603be05bbc5ba8a54e3ba..8279f5f834eb7221cdb215baac36510a9dae5255 100644 --- a/src/triSurface/triSurface/interfaces/VTK/readVTK.C +++ b/src/triSurface/triSurface/interfaces/VTK/readVTK.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -38,7 +38,7 @@ bool Foam::triSurface::readVTK(const fileName& fName) // Read (and triangulate) point, faces, zone info fileFormats::VTKsurfaceFormat<triFace> surf(fName); - List<labelledTri> tris(surf.faces().size()); + List<labelledTri> tris(surf.size()); forAll(tris, i) { const triFace& f = surf[i];