Commit 3952e184 authored by Franjo's avatar Franjo
Browse files

Merge commit '305155d8' into release

Conflicts:
	meshLibrary/cartesianMesh/cartesianMeshGenerator/cartesianMeshGenerator.C
	meshLibrary/hexMesh/hexMeshGenerator/hexMeshGenerator.C
	meshLibrary/voronoiMesh/voronoiMeshGenerator/voronoiMeshGenerator.C
parents 6cc870a9 305155d8
......@@ -69,6 +69,7 @@ triSurfaceClassifyEdges = $(triSurfaceTools)/triSurfaceClassifyEdges
triSurfacePatchManipulator = $(triSurfaceTools)/triSurfacePatchManipulator
triSurfaceRemoveFacets = $(triSurfaceTools)/triSurfaceRemoveFacets
triSurfaceExtrude2DEdges = $(triSurfaceTools)/triSurfaceExtrude2DEdges
triSurfaceMetaData = $(triSurfaceTools)/triSurfaceMetaData
polyMeshGen = utilities/meshes/polyMeshGen
boundaryPatch = utilities/meshes/polyMeshGen/boundaryPatch
......@@ -367,6 +368,8 @@ $(triSurfaceRemoveFacets)/triSurfaceRemoveFacetsFunctions.C
$(triSurfaceExtrude2DEdges)/triSurfaceExtrude2DEdges.C
$(triSurfaceMetaData)/triSurfaceMetaData.C
$(cartesianMeshExtractor)/cartesianMeshExtractor.C
$(cartesianMeshExtractor)/cartesianMeshExtractorPointsAndAddressing.C
$(cartesianMeshExtractor)/cartesianMeshExtractorPolyMesh.C
......
......@@ -47,6 +47,7 @@ Description
#include "checkIrregularSurfaceConnections.H"
#include "checkNonMappableCellConnections.H"
#include "checkBoundaryFacesSharingTwoEdges.H"
#include "triSurfaceMetaData.H"
//#define DEBUG
......@@ -265,6 +266,16 @@ cartesian2DMeshGenerator::cartesian2DMeshGenerator(const Time& time)
surfacePtr_ = new triSurf(db_.path()/surfaceFile);
if( true )
{
//- save meta data with the mesh (surface mesh + its topology info)
triSurfaceMetaData sMetaData(*surfacePtr_);
const dictionary& surfMetaDict = sMetaData.metaData();
mesh_.metaData().add("surfaceFile", surfaceFile);
mesh_.metaData().add("surfaceMeta", surfMetaDict);
}
if( surfacePtr_->featureEdges().size() != 0 )
{
//- create surface patches based on the feature edges
......
......@@ -46,6 +46,7 @@ Description
#include "checkIrregularSurfaceConnections.H"
#include "checkNonMappableCellConnections.H"
#include "checkBoundaryFacesSharingTwoEdges.H"
#include "triSurfaceMetaData.H"
//#define DEBUG
......@@ -282,6 +283,16 @@ cartesianMeshGenerator::cartesianMeshGenerator(const Time& time)
surfacePtr_ = new triSurf(db_.path()/surfaceFile);
if( true )
{
//- save meta data with the mesh (surface mesh + its topology info)
triSurfaceMetaData sMetaData(*surfacePtr_);
const dictionary& surfMetaDict = sMetaData.metaData();
mesh_.metaData().add("surfaceFile", surfaceFile);
mesh_.metaData().add("surfaceMeta", surfMetaDict);
}
if( surfacePtr_->featureEdges().size() != 0 )
{
//- create surface patches based on the feature edges
......
......@@ -44,6 +44,7 @@ Description
#include "checkMeshDict.H"
#include "triSurfacePatchManipulator.H"
#include "refineBoundaryLayers.H"
#include "triSurfaceMetaData.H"
//#define DEBUG
......@@ -271,6 +272,16 @@ tetMeshGenerator::tetMeshGenerator(const Time& time)
surfacePtr_ = new triSurf(runTime_.path()/surfaceFile);
if( true )
{
//- save meta data with the mesh (surface mesh + its topology info)
triSurfaceMetaData sMetaData(*surfacePtr_);
const dictionary& surfMetaDict = sMetaData.metaData();
mesh_.metaData().add("surfaceFile", surfaceFile);
mesh_.metaData().add("surfaceMeta", surfMetaDict);
}
if( surfacePtr_->featureEdges().size() != 0 )
{
//- create surface patches based on the feature edges
......
......@@ -27,6 +27,7 @@ Description
#include "polyMeshGen.H"
#include "demandDrivenData.H"
#include "OFstream.H"
namespace Foam
{
......@@ -35,7 +36,8 @@ namespace Foam
polyMeshGen::polyMeshGen(const Time& t)
:
polyMeshGenCells(t)
polyMeshGenCells(t),
metaDict_()
{}
//- Construct from components without the boundary
......@@ -47,7 +49,8 @@ polyMeshGen::polyMeshGen
const cellList& cells
)
:
polyMeshGenCells(t, points, faces, cells)
polyMeshGenCells(t, points, faces, cells),
metaDict_()
{}
//- Construct from components with the boundary
......@@ -71,7 +74,8 @@ polyMeshGen::polyMeshGen
patchNames,
patchStart,
nFacesInPatch
)
),
metaDict_()
{}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -84,11 +88,67 @@ polyMeshGen::~polyMeshGen()
void polyMeshGen::read()
{
polyMeshGenCells::read();
metaDict_ =
IOdictionary
(
IOobject
(
"meshMetaDict",
runTime_.constant(),
"polyMesh",
runTime_,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE
)
);
}
void polyMeshGen::write() const
{
//- remove old mesh before writting
const fileName meshDir = runTime_.path()/runTime_.constant()/"polyMesh";
rm(meshDir/"points");
rm(meshDir/"faces");
rm(meshDir/"owner");
rm(meshDir/"neighbour");
rm(meshDir/"cells");
rm(meshDir/"boundary");
rm(meshDir/"pointZones");
rm(meshDir/"faceZones");
rm(meshDir/"cellZones");
rm(meshDir/"meshModifiers");
rm(meshDir/"parallelData");
rm(meshDir/"meshMetaDict");
// remove sets if they exist
if (isDir(meshDir/"sets"))
{
rmDir(meshDir/"sets");
}
//- write the mesh
polyMeshGenCells::write();
//- write meta data
OFstream fName(meshDir/"meshMetaDict");
IOdictionary writeMeta
(
IOobject
(
"meshMetaDict",
runTime_.constant(),
"polyMesh",
runTime_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
metaDict_
);
writeMeta.writeHeader(fName);
writeMeta.writeData(fName);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -37,6 +37,7 @@ SourceFiles
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "polyMeshGenCells.H"
#include "dictionary.H"
namespace Foam
{
......@@ -46,6 +47,10 @@ namespace Foam
class polyMeshGen
: public polyMeshGenCells
{
// Private data
//- meta data about the meshing process
dictionary metaDict_;
public:
// Constructors
......@@ -77,6 +82,19 @@ public:
~polyMeshGen();
// Public member functions
//- return a constant reference to metaDict
inline const dictionary& metaData() const
{
return metaDict_;
}
//- return a reference to metaDict
inline dictionary& metaData()
{
return metaDict_;
}
// Read mesh
void read();
......
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 <http://www.gnu.org/licenses/>.
Description
\*---------------------------------------------------------------------------*/
#include "triSurfaceMetaData.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void triSurfaceMetaData::createMetaData()
{
metaDict_.clear();
metaDict_.add("nPoints", surf_.points().size());
metaDict_.add("nFacets", surf_.facets().size());
metaDict_.add("nPatches", surf_.patches().size());
metaDict_.add("nFeatureEdges", surf_.featureEdges().size());
dictionary dict;
//- store nformation about surface patches
labelList nInPatch(surf_.patches().size(), 0);
forAll(surf_, triI)
++nInPatch[surf_[triI].region()];
forAll(surf_.patches(), patchI)
{
const geometricSurfacePatch& patch = surf_.patches()[patchI];
dictionary pDict;
pDict.add("type", patch.geometricType());
pDict.add("nFacets", nInPatch[patchI]);
dict.add(patch.name(), pDict);
}
metaDict_.add("patches", dict);
//- store information about point subsets
DynList<label> subsetIds;
surf_.pointSubsetIndices(subsetIds);
dict.clear();
forAll(subsetIds, i)
{
dictionary sDict;
labelLongList inSubset;
surf_.pointsInSubset(subsetIds[i], inSubset);
sDict.add("nPoints", inSubset.size());
dict.add(surf_.pointSubsetName(subsetIds[i]), sDict);
}
metaDict_.add("pointSubsets", dict);
//- store information about facet subsets
subsetIds.clear();
surf_.facetSubsetIndices(subsetIds);
dict.clear();
forAll(subsetIds, i)
{
dictionary sDict;
labelLongList inSubset;
surf_.facetsInSubset(subsetIds[i], inSubset);
sDict.add("nFacets", inSubset.size());
dict.add(surf_.facetSubsetName(subsetIds[i]), sDict);
}
metaDict_.add("facetSubsets", dict);
//- store information about feature edge subsets
subsetIds.clear();
surf_.edgeSubsetIndices(subsetIds);
dict.clear();
forAll(subsetIds, i)
{
dictionary sDict;
labelLongList inSubset;
surf_.edgesInSubset(subsetIds[i], inSubset);
sDict.add("nEdges", inSubset.size());
dict.add(surf_.edgeSubsetName(subsetIds[i]), sDict);
}
metaDict_.add("featureEdgeSubsets", dict);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
triSurfaceMetaData::triSurfaceMetaData(const triSurf& surface)
:
surf_(surface),
metaDict_()
{
createMetaData();
}
triSurfaceMetaData::~triSurfaceMetaData()
{}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 <http://www.gnu.org/licenses/>.
Class
triSurfaceMetaData
Description
Generates meta data of the surface mesh. It contains:
The number of points
The number of triangles
The number of patches
The number of feature edges
The number of subsets, names, and the number of elements in each subset
SourceFiles
triSurfaceMetaData.C
\*---------------------------------------------------------------------------*/
#ifndef triSurfaceMetaData_H
#define triSurfaceMetaData_H
#include "triSurf.H"
#include "dictionary.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class triSurfaceMetaData Declaration
\*---------------------------------------------------------------------------*/
class triSurfaceMetaData
{
// Private data
//- const reference to triSurf
const triSurf& surf_;
//- patches/subsets for removal
dictionary metaDict_;
// Private member functions
//- create dictionary with meta data
void createMetaData();
//- Disallow default bitwise copy construct
triSurfaceMetaData(const triSurfaceMetaData&);
//- Disallow default bitwise assignment
void operator=(const triSurfaceMetaData&);
public:
// Constructors
//- Construct from triSurf
triSurfaceMetaData(const triSurf& surface);
// Destructor
~triSurfaceMetaData();
// Member Functions
//- return a constant reference to meta data
const dictionary& metaData() const
{
return metaDict_;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment