From eff9a36c3b97ddf2a79feb4412ad8471bd96bb9d Mon Sep 17 00:00:00 2001 From: Franjo Juretic Date: Thu, 25 Jun 2015 22:49:29 +0200 Subject: [PATCH] Merged executable and utilities --- .../mesh/cfMesh/FLMAToSurface/FLMAToSurface.C | 146 +++++ .../mesh/cfMesh/FLMAToSurface/Make/files | 3 + .../mesh/cfMesh/FLMAToSurface/Make/options | 11 + .../mesh/cfMesh/FMSToSurface/FMSToSurface.C | 166 ++++++ .../mesh/cfMesh/FMSToSurface/Make/files | 3 + .../mesh/cfMesh/FMSToSurface/Make/options | 11 + .../utilities/mesh/cfMesh/FMSToVTK/FMSToVTK.C | 545 ++++++++++++++++++ .../utilities/mesh/cfMesh/FMSToVTK/Make/files | 3 + .../mesh/cfMesh/FMSToVTK/Make/options | 11 + .../utilities/mesh/cfMesh/FMSToVTK/xmlTag.H | 297 ++++++++++ .../mesh/cfMesh/cartesian2DMesh/Make/files | 3 + .../mesh/cfMesh/cartesian2DMesh/Make/options | 13 + .../cfMesh/cartesian2DMesh/cartesian2DMesh.C | 61 ++ .../mesh/cfMesh/cartesianMesh/Make/files | 3 + .../mesh/cfMesh/cartesianMesh/Make/options | 13 + .../mesh/cfMesh/cartesianMesh/cartesianMesh.C | 59 ++ .../mesh/cfMesh/checkSurfaceMesh/Make/files | 3 + .../mesh/cfMesh/checkSurfaceMesh/Make/options | 11 + .../checkSurfaceMesh/checkSurfaceMesh.C | 226 ++++++++ .../mesh/cfMesh/copySurfaceParts/Make/files | 3 + .../mesh/cfMesh/copySurfaceParts/Make/options | 11 + .../copySurfaceParts/copySurfaceParts.C | 80 +++ .../extrudeEdgesInto2DSurface/Make/files | 3 + .../extrudeEdgesInto2DSurface/Make/options | 11 + .../extrudeEdgesInto2DSurface.C | 74 +++ .../cfMesh/generateBoundaryLayers/Make/files | 3 + .../generateBoundaryLayers/Make/options | 11 + .../generateBoundaryLayers.C | 148 +++++ .../cfMesh/importSurfaceAsSubset/Make/files | 3 + .../cfMesh/importSurfaceAsSubset/Make/options | 11 + .../importSurfaceAsSubset.C | 84 +++ .../mesh/cfMesh/improveMeshQuality/Make/files | 3 + .../cfMesh/improveMeshQuality/Make/options | 11 + .../improveMeshQuality/improveMeshQuality.C | 156 +++++ .../cfMesh/improveSymmetryPlanes/Make/files | 3 + .../cfMesh/improveSymmetryPlanes/Make/options | 9 + .../improveSymmetryPlanes.C | 57 ++ .../cfMesh/mergeSurfacePatches/Make/files | 3 + .../cfMesh/mergeSurfacePatches/Make/options | 11 + .../mergeSurfacePatches/mergeSurfacePatches.C | 403 +++++++++++++ .../mesh/cfMesh/meshToFPMA/Make/files | 3 + .../mesh/cfMesh/meshToFPMA/Make/options | 9 + .../mesh/cfMesh/meshToFPMA/meshToFPMA.C | 58 ++ .../utilities/mesh/cfMesh/pMesh/Make/files | 3 + .../utilities/mesh/cfMesh/pMesh/Make/options | 13 + .../utilities/mesh/cfMesh/pMesh/pMesh.C | 61 ++ .../mesh/cfMesh/patchesToSubsets/Make/files | 3 + .../mesh/cfMesh/patchesToSubsets/Make/options | 11 + .../patchesToSubsets/patchesToSubsets.C | 84 +++ .../mesh/cfMesh/preparePar/Make/files | 3 + .../mesh/cfMesh/preparePar/Make/options | 11 + .../mesh/cfMesh/preparePar/preparePar.C | 100 ++++ .../cfMesh/removeSurfaceFacets/Make/files | 3 + .../cfMesh/removeSurfaceFacets/Make/options | 11 + .../removeSurfaceFacets/removeSurfaceFacets.C | 72 +++ .../mesh/cfMesh/scaleMesh/Make/files | 3 + .../mesh/cfMesh/scaleMesh/Make/options | 11 + .../mesh/cfMesh/scaleMesh/scaleMesh.C | 73 +++ .../mesh/cfMesh/scaleSurfaceMesh/Make/files | 3 + .../mesh/cfMesh/scaleSurfaceMesh/Make/options | 11 + .../scaleSurfaceMesh/scaleSurfaceMesh.C | 74 +++ .../mesh/cfMesh/subsetToPatch/Make/files | 3 + .../mesh/cfMesh/subsetToPatch/Make/options | 11 + .../mesh/cfMesh/subsetToPatch/subsetToPatch.C | 170 ++++++ .../cfMesh/surfaceFeatureEdges/Make/files | 3 + .../cfMesh/surfaceFeatureEdges/Make/options | 11 + .../surfaceFeatureEdges/surfaceFeatureEdges.C | 104 ++++ .../surfaceGenerateBoundingBox/Make/files | 3 + .../surfaceGenerateBoundingBox/Make/options | 11 + .../surfaceGenerateBoundingBox.C | 178 ++++++ .../mesh/cfMesh/surfaceToFMS/Make/files | 3 + .../mesh/cfMesh/surfaceToFMS/Make/options | 11 + .../mesh/cfMesh/surfaceToFMS/surfaceToFMS.C | 63 ++ .../utilities/mesh/cfMesh/tetMesh/Make/files | 3 + .../mesh/cfMesh/tetMesh/Make/options | 13 + .../utilities/mesh/cfMesh/tetMesh/tetMesh.C | 61 ++ 76 files changed, 3954 insertions(+) create mode 100644 applications/utilities/mesh/cfMesh/FLMAToSurface/FLMAToSurface.C create mode 100644 applications/utilities/mesh/cfMesh/FLMAToSurface/Make/files create mode 100644 applications/utilities/mesh/cfMesh/FLMAToSurface/Make/options create mode 100644 applications/utilities/mesh/cfMesh/FMSToSurface/FMSToSurface.C create mode 100644 applications/utilities/mesh/cfMesh/FMSToSurface/Make/files create mode 100644 applications/utilities/mesh/cfMesh/FMSToSurface/Make/options create mode 100644 applications/utilities/mesh/cfMesh/FMSToVTK/FMSToVTK.C create mode 100644 applications/utilities/mesh/cfMesh/FMSToVTK/Make/files create mode 100644 applications/utilities/mesh/cfMesh/FMSToVTK/Make/options create mode 100644 applications/utilities/mesh/cfMesh/FMSToVTK/xmlTag.H create mode 100644 applications/utilities/mesh/cfMesh/cartesian2DMesh/Make/files create mode 100644 applications/utilities/mesh/cfMesh/cartesian2DMesh/Make/options create mode 100644 applications/utilities/mesh/cfMesh/cartesian2DMesh/cartesian2DMesh.C create mode 100644 applications/utilities/mesh/cfMesh/cartesianMesh/Make/files create mode 100644 applications/utilities/mesh/cfMesh/cartesianMesh/Make/options create mode 100644 applications/utilities/mesh/cfMesh/cartesianMesh/cartesianMesh.C create mode 100644 applications/utilities/mesh/cfMesh/checkSurfaceMesh/Make/files create mode 100644 applications/utilities/mesh/cfMesh/checkSurfaceMesh/Make/options create mode 100644 applications/utilities/mesh/cfMesh/checkSurfaceMesh/checkSurfaceMesh.C create mode 100644 applications/utilities/mesh/cfMesh/copySurfaceParts/Make/files create mode 100644 applications/utilities/mesh/cfMesh/copySurfaceParts/Make/options create mode 100644 applications/utilities/mesh/cfMesh/copySurfaceParts/copySurfaceParts.C create mode 100644 applications/utilities/mesh/cfMesh/extrudeEdgesInto2DSurface/Make/files create mode 100644 applications/utilities/mesh/cfMesh/extrudeEdgesInto2DSurface/Make/options create mode 100644 applications/utilities/mesh/cfMesh/extrudeEdgesInto2DSurface/extrudeEdgesInto2DSurface.C create mode 100644 applications/utilities/mesh/cfMesh/generateBoundaryLayers/Make/files create mode 100644 applications/utilities/mesh/cfMesh/generateBoundaryLayers/Make/options create mode 100644 applications/utilities/mesh/cfMesh/generateBoundaryLayers/generateBoundaryLayers.C create mode 100644 applications/utilities/mesh/cfMesh/importSurfaceAsSubset/Make/files create mode 100644 applications/utilities/mesh/cfMesh/importSurfaceAsSubset/Make/options create mode 100644 applications/utilities/mesh/cfMesh/importSurfaceAsSubset/importSurfaceAsSubset.C create mode 100644 applications/utilities/mesh/cfMesh/improveMeshQuality/Make/files create mode 100644 applications/utilities/mesh/cfMesh/improveMeshQuality/Make/options create mode 100644 applications/utilities/mesh/cfMesh/improveMeshQuality/improveMeshQuality.C create mode 100644 applications/utilities/mesh/cfMesh/improveSymmetryPlanes/Make/files create mode 100644 applications/utilities/mesh/cfMesh/improveSymmetryPlanes/Make/options create mode 100644 applications/utilities/mesh/cfMesh/improveSymmetryPlanes/improveSymmetryPlanes.C create mode 100644 applications/utilities/mesh/cfMesh/mergeSurfacePatches/Make/files create mode 100644 applications/utilities/mesh/cfMesh/mergeSurfacePatches/Make/options create mode 100644 applications/utilities/mesh/cfMesh/mergeSurfacePatches/mergeSurfacePatches.C create mode 100644 applications/utilities/mesh/cfMesh/meshToFPMA/Make/files create mode 100644 applications/utilities/mesh/cfMesh/meshToFPMA/Make/options create mode 100644 applications/utilities/mesh/cfMesh/meshToFPMA/meshToFPMA.C create mode 100755 applications/utilities/mesh/cfMesh/pMesh/Make/files create mode 100755 applications/utilities/mesh/cfMesh/pMesh/Make/options create mode 100644 applications/utilities/mesh/cfMesh/pMesh/pMesh.C create mode 100644 applications/utilities/mesh/cfMesh/patchesToSubsets/Make/files create mode 100644 applications/utilities/mesh/cfMesh/patchesToSubsets/Make/options create mode 100644 applications/utilities/mesh/cfMesh/patchesToSubsets/patchesToSubsets.C create mode 100644 applications/utilities/mesh/cfMesh/preparePar/Make/files create mode 100644 applications/utilities/mesh/cfMesh/preparePar/Make/options create mode 100644 applications/utilities/mesh/cfMesh/preparePar/preparePar.C create mode 100644 applications/utilities/mesh/cfMesh/removeSurfaceFacets/Make/files create mode 100644 applications/utilities/mesh/cfMesh/removeSurfaceFacets/Make/options create mode 100644 applications/utilities/mesh/cfMesh/removeSurfaceFacets/removeSurfaceFacets.C create mode 100644 applications/utilities/mesh/cfMesh/scaleMesh/Make/files create mode 100644 applications/utilities/mesh/cfMesh/scaleMesh/Make/options create mode 100644 applications/utilities/mesh/cfMesh/scaleMesh/scaleMesh.C create mode 100644 applications/utilities/mesh/cfMesh/scaleSurfaceMesh/Make/files create mode 100644 applications/utilities/mesh/cfMesh/scaleSurfaceMesh/Make/options create mode 100644 applications/utilities/mesh/cfMesh/scaleSurfaceMesh/scaleSurfaceMesh.C create mode 100644 applications/utilities/mesh/cfMesh/subsetToPatch/Make/files create mode 100644 applications/utilities/mesh/cfMesh/subsetToPatch/Make/options create mode 100644 applications/utilities/mesh/cfMesh/subsetToPatch/subsetToPatch.C create mode 100644 applications/utilities/mesh/cfMesh/surfaceFeatureEdges/Make/files create mode 100644 applications/utilities/mesh/cfMesh/surfaceFeatureEdges/Make/options create mode 100644 applications/utilities/mesh/cfMesh/surfaceFeatureEdges/surfaceFeatureEdges.C create mode 100644 applications/utilities/mesh/cfMesh/surfaceGenerateBoundingBox/Make/files create mode 100644 applications/utilities/mesh/cfMesh/surfaceGenerateBoundingBox/Make/options create mode 100644 applications/utilities/mesh/cfMesh/surfaceGenerateBoundingBox/surfaceGenerateBoundingBox.C create mode 100644 applications/utilities/mesh/cfMesh/surfaceToFMS/Make/files create mode 100644 applications/utilities/mesh/cfMesh/surfaceToFMS/Make/options create mode 100644 applications/utilities/mesh/cfMesh/surfaceToFMS/surfaceToFMS.C create mode 100644 applications/utilities/mesh/cfMesh/tetMesh/Make/files create mode 100644 applications/utilities/mesh/cfMesh/tetMesh/Make/options create mode 100644 applications/utilities/mesh/cfMesh/tetMesh/tetMesh.C diff --git a/applications/utilities/mesh/cfMesh/FLMAToSurface/FLMAToSurface.C b/applications/utilities/mesh/cfMesh/FLMAToSurface/FLMAToSurface.C new file mode 100644 index 000000000..7db892462 --- /dev/null +++ b/applications/utilities/mesh/cfMesh/FLMAToSurface/FLMAToSurface.C @@ -0,0 +1,146 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | cfMesh: A library for mesh generation + \\ / O peration | + \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com) + \\/ M anipulation | Copyright (C) Creative Fields, Ltd. +------------------------------------------------------------------------------- +License + This file is part of cfMesh. + + cfMesh 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. + + cfMesh 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 cfMesh. If not, see . + +Description + Reads the AVL's surface mesh + +\*---------------------------------------------------------------------------*/ + +#include "argList.H" +#include "Time.H" +#include "triSurf.H" +#include "triSurfModifier.H" +#include "triFaceList.H" +#include "labelLongList.H" +#include "IFstream.H" + +using namespace Foam; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main(int argc, char *argv[]) +{ + argList::noParallel(); + argList::validArgs.clear(); + + argList::validArgs.append("input surface file"); + argList::validArgs.append("output surface file"); + argList args(argc, argv); + + fileName inFileName(args.args()[1]); + fileName outFileName(args.args()[2]); + + if( inFileName.ext() != "flma" ) + { + Info << "Cannot convert this mesh" << endl; + return 0; + } + + //- create the surface mesh + triSurf ts; + triSurfModifier tsm(ts); + + label counter; + + IFstream inFile(inFileName); + + inFile >> counter; + + //- read vertices + pointField& points = tsm.pointsAccess(); + points.setSize(counter); + forAll(points, pointI) + { + point& p = points[pointI]; + + inFile >> p.x(); + inFile >> p.y(); + inFile >> p.z(); + } + + //- read facets + inFile >> counter; + geometricSurfacePatchList patches(1); + patches[0].name() = "patch"; + LongList& triangles = tsm.facetsAccess(); + triangles.setSize(counter); + forAll(triangles, triI) + { + inFile >> counter; + + if( counter != 3 ) + { + Info << "Facet " << triI << " is not a triangle!!" << endl; + Warning << "Cannot convert this surface!" << endl; + return 0; + } + + for(label j=0;j<3;++j) + inFile >> triangles[triI][2-j]; + + triangles[triI].region() = 0; + } + + //- read cell types + inFile >> counter; + forAll(triangles, triI) + inFile >> counter; + + //- start reading selections + inFile >> counter; + for(label selI=0;selI> selName; + + //- read selection type + label selType; + inFile >> selType; + + //- read selection entries + label size; + inFile >> size; + labelLongList entries(size); + for(label i=0;i> entries[i]; + + //- store cell selections + if( selType == 2 ) + { + Info << "Adding subset " << selName << endl; + const label setID = ts.addFacetSubset(selName); + + forAll(entries, i) + ts.addFacetToSubset(setID, entries[i]); + } + } + + //- write the surface + ts.writeSurface(outFileName); + + Info << "End\n" << endl; + return 0; +} + +// ************************************************************************* // diff --git a/applications/utilities/mesh/cfMesh/FLMAToSurface/Make/files b/applications/utilities/mesh/cfMesh/FLMAToSurface/Make/files new file mode 100644 index 000000000..69610873c --- /dev/null +++ b/applications/utilities/mesh/cfMesh/FLMAToSurface/Make/files @@ -0,0 +1,3 @@ +FLMAToSurface.C + +EXE = $(FOAM_APPBIN)/FLMAToSurface diff --git a/applications/utilities/mesh/cfMesh/FLMAToSurface/Make/options b/applications/utilities/mesh/cfMesh/FLMAToSurface/Make/options new file mode 100644 index 000000000..b827d4531 --- /dev/null +++ b/applications/utilities/mesh/cfMesh/FLMAToSurface/Make/options @@ -0,0 +1,11 @@ +EXE_INC = \ + -I../../meshLibrary/lnInclude \ + -I$(LIB_SRC)/triSurface/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/edgeMesh/lnInclude + +EXE_LIBS = \ + -ltriSurface \ + -lmeshLibrary \ + -lmeshTools \ + -ledgeMesh diff --git a/applications/utilities/mesh/cfMesh/FMSToSurface/FMSToSurface.C b/applications/utilities/mesh/cfMesh/FMSToSurface/FMSToSurface.C new file mode 100644 index 000000000..bd4ad4fde --- /dev/null +++ b/applications/utilities/mesh/cfMesh/FMSToSurface/FMSToSurface.C @@ -0,0 +1,166 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | cfMesh: A library for mesh generation + \\ / O peration | + \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com) + \\/ M anipulation | Copyright (C) Creative Fields, Ltd. +------------------------------------------------------------------------------- +License + This file is part of cfMesh. + + cfMesh 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. + + cfMesh 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 cfMesh. If not, see . + +Description + Creates surface patches from surface subsets + +\*---------------------------------------------------------------------------*/ + +#include "argList.H" +#include "Time.H" +#include "triSurf.H" +#include "triSurfaceCopyParts.H" +#include "demandDrivenData.H" +#include "OFstream.H" + +using namespace Foam; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +void exportFeatureEdges +( + const triSurf& origSurf, + const fileName& edgeFileName +) +{ + OFstream file(edgeFileName); + + const pointField& points = origSurf.points(); + labelList newPointLabel(points.size(), -1); + label nPoints(0); + + const edgeLongList& featureEdges = origSurf.featureEdges(); + forAll(featureEdges, feI) + { + const edge& e = featureEdges[feI]; + + if( newPointLabel[e[0]] == -1 ) + newPointLabel[e[0]] = nPoints++; + if( newPointLabel[e[1]] == -1 ) + newPointLabel[e[1]] = nPoints++; + } + + pointField pCopy(nPoints); + forAll(newPointLabel, pI) + { + if( newPointLabel[pI] < 0 ) + continue; + + pCopy[newPointLabel[pI]] = points[pI]; + } + + //- write the header + file << "# vtk DataFile Version 3.0\n"; + file << "vtk output\n"; + file << "ASCII\n"; + file << "DATASET POLYDATA\n"; + + //- write points + file << "POINTS " << pCopy.size() << " float\n"; + forAll(pCopy, pI) + { + const point& p = pCopy[pI]; + file << p.x() << ' ' << p.y() << ' ' << p.z() << '\n'; + } + + file << "\nLINES " << featureEdges.size() + << ' ' << 3*featureEdges.size() << nl; + forAll(featureEdges, edgeI) + { + const edge& e = featureEdges[edgeI]; + file << "2 " << newPointLabel[e[0]] + << token::SPACE << newPointLabel[e[1]] << nl; + } + file << nl; + + if( !file ) + FatalErrorIn + ( + "void exportFeatureEdges(const triSurf&, const fileName&)" + ) << "Writting of feature edges failed!" << exit(FatalError); +} + +int main(int argc, char *argv[]) +{ + argList::noParallel(); + argList::validArgs.clear(); + + argList::validArgs.append("input surface file"); + argList::validArgs.append("output surface file"); + argList::validOptions.insert("exportSubsets", ""); + argList::validOptions.insert("exportFeatureEdges", ""); + argList args(argc, argv); + + fileName inFileName(args.args()[1]); + fileName outFileName(args.args()[2]); + + fileName outFileNoExt = outFileName.lessExt(); + fileName outExtension = outFileName.ext(); + + Info << "Out file no ext " << outFileNoExt << endl; + Info << "Extension " << outExtension << endl; + + //- read the inout surface + triSurf origSurf(inFileName); + + //- write the surface in the requated format + origSurf.writeSurface(outFileName); + + //- export surface subsets as separate surface meshes + if( args.options().found("exportSubsets") ) + { + DynList