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 025ba5885d..9b69ae120e 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::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/manipulation/checkMesh/Make/options b/applications/utilities/mesh/manipulation/checkMesh/Make/options index 0653767f3e..5d3dac934f 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 220e8275f9..b2b265cc05 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 00afbde489..a26d989123 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 f7e149613f..79021d1a46 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 b5f74359bc..477d4cbafc 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 ef204ab685..28fb9f2cce 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 baa0617eeb..dcbf38b870 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 3b0a9bdebd..86bfe9a22e 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/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValueTemplates.C b/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValueTemplates.C index 68158b58ff..5272714d95 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 dc893c1148..a94e947f67 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 adc6a30ca1..2d2ac4d45a 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::write() ( this->writeTimeDir(), fZone.name(), - allPoints, - allFaces, + meshedSurfRef(allPoints, allFaces), "massTotal", zoneMassTotal[zoneI], false @@ -215,8 +214,7 @@ void Foam::FacePostProcessing::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 ffa42aaf4e..8ea2b51386 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::write() Info<< type() << " output:" << nl; - Field faceMassTotal(mass_.size(), 0.0); + Field faceMassTotal(mass_.size(), Zero); this->getModelProperty("massTotal", faceMassTotal); - Field faceMassFlowRate(massFlowRate_.size(), 0.0); + Field faceMassFlowRate(massFlowRate_.size(), Zero); this->getModelProperty("massFlowRate", faceMassFlowRate); @@ -467,8 +467,7 @@ void Foam::ParticleCollector::write() ( this->writeTimeDir(), "collector", - points_, - faces_, + meshedSurfRef(points_, faces_), "massTotal", faceMassTotal, false @@ -478,8 +477,7 @@ void Foam::ParticleCollector::write() ( this->writeTimeDir(), "collector", - points_, - faces_, + meshedSurfRef(points_, faces_), "massFlowRate", faceMassFlowRate, false @@ -490,7 +488,7 @@ void Foam::ParticleCollector::write() if (resetOnWrite_) { - Field dummy(faceMassTotal.size(), 0.0); + Field 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 b45129b838..34e92f4b47 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/randomProcesses/noise/noiseModels/surfaceNoise/surfaceNoise.C b/src/randomProcesses/noise/noiseModels/surfaceNoise/surfaceNoise.C index 51e61a5cc6..f24289c495 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.surfFaces(), + 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.surfFaces(), + meshedSurfRef + ( + surf.points(), + surf.surfFaces() + ), title, data, false diff --git a/src/sampling/sampledSurface/distanceSurface/distanceSurface.H b/src/sampling/sampledSurface/distanceSurface/distanceSurface.H index 407e8914db..0ca56d0808 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 19efe340b7..8be9053eea 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 f7a267aa9d..4d0952b2e6 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 1639084714..bd026f2b91 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 dace070320..5b8b3f5559 100644 --- a/src/sampling/sampledSurface/readers/ensight/ensightSurfaceReaderTemplates.C +++ b/src/sampling/sampledSurface/readers/ensight/ensightSurfaceReaderTemplates.C @@ -88,7 +88,7 @@ Foam::tmp > 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::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 c4fb497767..6af6064921 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 36cf5829a4..76800d8c62 100644 --- a/src/sampling/sampledSurface/sampledPatch/sampledPatch.H +++ b/src/sampling/sampledSurface/sampledPatch/sampledPatch.H @@ -180,6 +180,12 @@ public: return MeshStorage::surfFaces(); } + //- Const access to per-face zone/region information + virtual const labelList& zoneIds() const + { + return Foam::emptyLabelList; + } + //- Face area vectors virtual const vectorField& Sf() const { diff --git a/src/sampling/sampledSurface/sampledPlane/sampledPlane.H b/src/sampling/sampledSurface/sampledPlane/sampledPlane.H index 6d82afa526..4171cb3e36 100644 --- a/src/sampling/sampledSurface/sampledPlane/sampledPlane.H +++ b/src/sampling/sampledSurface/sampledPlane/sampledPlane.H @@ -140,6 +140,13 @@ public: 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 virtual const vectorField& Sf() const { diff --git a/src/sampling/sampledSurface/sampledSurface/sampledSurface.H b/src/sampling/sampledSurface/sampledSurface/sampledSurface.H index 3ddf4c2980..b625675eff 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 88eb52b091..37868113d8 100644 --- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C +++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C @@ -72,20 +72,17 @@ void Foam::sampledSurfaces::writeGeometry() const ( outputDir, s.name(), - mergeList_[surfI].points, - mergeList_[surfI].faces + meshedSurfRef + ( + mergeList_[surfI].points, + mergeList_[surfI].faces + ) ); } } else if (s.faces().size()) { - formatter_->write - ( - outputDir, - s.name(), - s.points(), - s.faces() - ); + formatter_->write(outputDir, s.name(), s); } } } diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H index 5d817632b5..dffb658966 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. diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C index 7925cf25f0..db19cb0825 100644 --- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C +++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C @@ -79,8 +79,11 @@ void Foam::sampledSurfaces::writeSurface ( outputDir, s.name(), - mergeList_[surfI].points, - mergeList_[surfI].faces, + meshedSurfRef + ( + mergeList_[surfI].points, + mergeList_[surfI].faces + ), fieldName, allValues, s.interpolate() @@ -106,8 +109,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 eccbcddd8b..c1c08006d4 100644 --- a/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMesh.C +++ b/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMesh.C @@ -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::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 ef2e9dce1f..7403bfc65e 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 + public UnsortedMeshedSurface { public: //- Types of communications @@ -101,7 +101,7 @@ public: private: //- Private typedefs for convenience - typedef MeshedSurface MeshStorage; + typedef UnsortedMeshedSurface MeshStorage; // Private data @@ -216,6 +216,12 @@ public: return MeshStorage::surfFaces(); } + //- Const access to per-face zone/region information + virtual const labelList& zoneIds() const + { + return MeshStorage::zoneIds(); + } + //- Face area vectors virtual const vectorField& Sf() const { diff --git a/src/sampling/sampledSurface/thresholdCellFaces/sampledThresholdCellFaces.H b/src/sampling/sampledSurface/thresholdCellFaces/sampledThresholdCellFaces.H index 779b20bad1..8f097f4262 100644 --- a/src/sampling/sampledSurface/thresholdCellFaces/sampledThresholdCellFaces.H +++ b/src/sampling/sampledSurface/thresholdCellFaces/sampledThresholdCellFaces.H @@ -148,6 +148,12 @@ public: return MeshStorage::surfFaces(); } + //- Const access to per-face zone/region information + virtual const labelList& zoneIds() const + { + return Foam::emptyLabelList; + } + //- Face area vectors (normals) virtual const vectorField& Sf() const { diff --git a/src/sampling/sampledSurface/writers/boundaryData/boundaryDataSurfaceWriter.C b/src/sampling/sampledSurface/writers/boundaryData/boundaryDataSurfaceWriter.C index 076a9a4226..aaf7aebd78 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 b70b4d47c5..57da092b71 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& 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, // /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& 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, // /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& 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, // /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& 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, // /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& 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, // /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& 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 ec0db202d5..dcc9452d00 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& 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 27015fe21e..6f06073257 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 51eceeda3e..8a169d3beb 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 @@ -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& values, const bool isNodeValues, @@ -98,13 +97,12 @@ public: ( const fileName& outputDir, // /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& 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, // /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& 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, // /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& 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, // /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& 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, // /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& 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 835f2b2b95..f9bb67c99a 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& 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 ac2457010d..fd89f72f5a 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 9d5ff392b4..58325c1a26 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& 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& 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& 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, // /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& 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, // /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& 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, // /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& 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, // /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& 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, // /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& 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 01a0716a9d..34d218dac8 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& 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& 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& 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 4471a002ee..4a59a92347 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 8b541c6162..cc9bdc661e 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& 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, // /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& 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, // /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& 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, // /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& 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, // /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& 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, // /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& 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 c21909d653..1a9f1736a5 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& values, const bool isNodeValues, diff --git a/src/sampling/sampledSurface/writers/makeSurfaceWriterMethods.H b/src/sampling/sampledSurface/writers/makeSurfaceWriterMethods.H index 448cff18c5..fadcf23ad2 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& 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 11c6dcff47..adfe60f566 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. @@ -27,6 +27,7 @@ License #include "IOmanip.H" #include "Tuple2.H" #include "makeSurfaceWriterMethods.H" +#include "HashSet.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -204,6 +205,7 @@ void Foam::nastranSurfaceWriter::writeFace const word& faceType, const labelList& facePts, label& nFace, + const label PID, OFstream& os ) const { @@ -221,16 +223,12 @@ void Foam::nastranSurfaceWriter::writeFace // For CTRIA3 elements, cols 7 onwards are not used - label PID = 1; - writeKeyword(faceType, os); - os << separator_; os.setf(ios_base::right); writeValue(nFace++, os); - os << separator_; writeValue(PID, os); @@ -286,12 +284,15 @@ void Foam::nastranSurfaceWriter::writeFace void Foam::nastranSurfaceWriter::writeGeometry ( - const pointField& points, - const faceList& faces, + const meshedSurf& surf, List>& decomposedFaces, OFstream& os ) const { + const pointField& points = surf.points(); + const faceList& faces = surf.faces(); + const labelList& zones = surf.zoneIds(); + // Write points os << "$" << nl @@ -303,28 +304,31 @@ void Foam::nastranSurfaceWriter::writeGeometry writeCoord(points[pointi], pointi, os); } - // Write faces + decomposedFaces.clear(); + decomposedFaces.setSize(faces.size()); os << "$" << nl << "$ Faces" << nl << "$" << nl; - label nFace = 1; + label nFace = 1; // 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("CTRIA3", f, nFace, PID, os); + decomposedFaces[facei].append(f); } else if (f.size() == 4) { - writeFace("CQUAD4", faces[facei], nFace, os); - decomposedFaces[facei].append(faces[facei]); + writeFace("CQUAD4", f, nFace, PID, os); + decomposedFaces[facei].append(f); } else { @@ -335,7 +339,7 @@ void Foam::nastranSurfaceWriter::writeGeometry forAll(triFaces, trii) { - writeFace("CTRIA3", triFaces[trii], nFace, os); + writeFace("CTRIA3", triFaces[trii], nFace, PID, os); decomposedFaces[facei].append(triFaces[trii]); } } @@ -343,29 +347,42 @@ void Foam::nastranSurfaceWriter::writeGeometry } -void Foam::nastranSurfaceWriter::writeFooter(Ostream& os) const +void Foam::nastranSurfaceWriter::writeFooter +( + Ostream& os, + const meshedSurf& surf +) const { - label PID = 1; + // zone id have been used for the PID. Find unique values. - writeKeyword("PSHELL", os); - - os << separator_; - - writeValue(PID, os); - - for (label i = 0; i < 7; i++) + labelList pidsUsed = labelHashSet(surf.zoneIds()).sortedToc(); + if (pidsUsed.empty()) { - // Dummy values - os << separator_; - writeValue(1, os); + pidsUsed.setSize(1, Zero); // fallback } - os << nl; - writeKeyword("MAT1", os); - os << separator_; + for (auto pid : pidsUsed) + { + writeKeyword("PSHELL", os); + os << separator_; + writeValue(pid+1, os); // 1-offset for PID + + for (label i = 0; i < 7; i++) + { + // Dummy values + os << separator_; + writeValue(1, os); + } + os << nl; + } + + + // use single material ID label MID = 1; + writeKeyword("MAT1", os); + os << separator_; writeValue(MID, os); for (label i = 0; i < 7; i++) @@ -374,7 +391,6 @@ void Foam::nastranSurfaceWriter::writeFooter(Ostream& os) const os << separator_; writeValue("", os); } - os << nl; } @@ -431,8 +447,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 { @@ -453,16 +468,15 @@ Foam::fileName Foam::nastranSurfaceWriter::write << "$" << nl << "BEGIN BULK" << nl; - List> decomposedFaces(faces.size()); - - writeGeometry(points, faces, decomposedFaces, os); + List> decomposedFaces; + writeGeometry(surf, decomposedFaces, os); if (!isDir(outputDir)) { mkDir(outputDir); } - writeFooter(os); + writeFooter(os, surf); os << "ENDDATA" << endl; diff --git a/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriter.H b/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriter.H index ae0cc8c839..cfee9c3952 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,21 +82,20 @@ public: wfFree }; - static const NamedEnum writeFormatNames_; - enum dataFormat { dfPLOAD2, dfPLOAD4 }; - static const NamedEnum dataFormatNames_; - private: // Private data + static const NamedEnum writeFormatNames_; + static const NamedEnum dataFormatNames_; + //- Write option writeFormat writeFormat_; @@ -127,14 +128,14 @@ private: const word& faceType, const labelList& facePts, label& nFace, + const label PID, OFstream& os ) const; //- Main driver to write the surface mesh geometry void writeGeometry ( - const pointField& points, - const faceList& faces, + const meshedSurf& surf, List>& decomposedFaces, OFstream& os ) const; @@ -147,7 +148,7 @@ private: ) const; //- Write the footer information - void writeFooter(Ostream& os) const; + void writeFooter(Ostream& os, const meshedSurf& surf) const; //- Write a formatted value to the output stream template @@ -173,8 +174,7 @@ private: ( const fileName& outputDir, const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, const Field& values, const bool isNodeValues, @@ -215,10 +215,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 +225,12 @@ public: ( const fileName& outputDir, const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, const Field& 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 +238,12 @@ public: ( const fileName& outputDir, const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, const Field& 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 +251,12 @@ public: ( const fileName& outputDir, const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, const Field& 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 +264,12 @@ public: ( const fileName& outputDir, const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, const Field& 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 +277,12 @@ public: ( const fileName& outputDir, const fileName& surfaceName, - const pointField& points, - const faceList& faces, + const meshedSurf& surf, const word& fieldName, const Field& 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 412bbeb0f3..4ee46f5eb0 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. @@ -115,9 +115,9 @@ void Foam::nastranSurfaceWriter::writeFaceValue os << separator_; writeValue(EID, os); - break; } + case dfPLOAD4: { writeValue(EID, os); @@ -129,6 +129,7 @@ void Foam::nastranSurfaceWriter::writeFaceValue } break; } + default: { FatalErrorInFunction @@ -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& values, const bool isNodeValues, @@ -192,10 +192,8 @@ Foam::fileName Foam::nastranSurfaceWriter::writeTemplate << "$" << nl << "BEGIN BULK" << nl; - List> decomposedFaces(faces.size()); - - writeGeometry(points, faces, decomposedFaces, os); - + List> decomposedFaces; + writeGeometry(surf, decomposedFaces, os); os << "$" << nl << "$ Field data" << nl @@ -238,7 +236,7 @@ Foam::fileName Foam::nastranSurfaceWriter::writeTemplate } } - writeFooter(os); + writeFooter(os, surf); os << "ENDDATA" << endl; diff --git a/src/sampling/sampledSurface/writers/proxy/proxySurfaceWriter.C b/src/sampling/sampledSurface/writers/proxy/proxySurfaceWriter.C index c92c09d8f6..2ec4dae0a0 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(points, faces).write(outName); + MeshedSurfaceProxy(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 3ace22ea84..62ba62705e 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 b5e93dc6cb..364b0a4270 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 a679251af4..986b588862 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 @@ -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& 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, // /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& 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, // /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& 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, // /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& 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, // /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& 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, // /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& 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 3341378838..bf0cb44f22 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& 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 2b58417a5b..3f79e3891c 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(points, faces).write(outName); + MeshedSurfaceProxy(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 aeaed7d30b..d5a9d87552 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& 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, // /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& 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, // /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& 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, // /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& 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 026b5b7425..d14b3da6fb 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& values, const bool isNodeValues, diff --git a/src/sampling/sampledSurface/writers/surfaceWriter.H b/src/sampling/sampledSurface/writers/surfaceWriter.H index bd4c404203..a640fb5a05 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, // /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, // /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& values, const bool isNodeValues, @@ -151,8 +147,7 @@ public: ( const fileName& outputDir, // /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& values, const bool isNodeValues, @@ -168,8 +163,7 @@ public: ( const fileName& outputDir, // /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& values, const bool isNodeValues, @@ -185,8 +179,7 @@ public: ( const fileName& outputDir, // /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& values, const bool isNodeValues, @@ -202,8 +195,7 @@ public: ( const fileName& outputDir, // /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& values, const bool isNodeValues, diff --git a/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriter.C b/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriter.C index f7d8c0fd69..9b4c28c1ed 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 f3d17fc2b9..85ab3026e9 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 static void writeData(Ostream&, const Field&); @@ -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& 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, // /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& 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, // /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& 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, // /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& 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, // /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& 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, // /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& 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 6ceb45e464..ee7c129d52 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& 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)