Commit 1bbecd19 authored by Franjo's avatar Franjo

Surface to fms conversion

Initial commit
parent 9bb60eda
......@@ -312,8 +312,6 @@ cartesian2DMeshGenerator::cartesian2DMeshGenerator(const Time& time)
//- delete the old surface and assign the new one
deleteDemandDrivenData(surfacePtr_);
surfacePtr_ = surfaceWithPatches;
surfacePtr_->writeSurface("surfWithPatches.fms");
}
octreePtr_ = new meshOctree(*surfacePtr_, true);
......
......@@ -29,8 +29,6 @@ Description
#include "meshOctree.H"
#include "triSurface.H"
#include "polyMeshGenModifierAddCellByCell.H"
#include "tessellationElement.H"
#include "tessellationDimSpace.H"
#include "demandDrivenData.H"
# ifdef USE_OMP
......@@ -104,23 +102,53 @@ void tetMeshExtractorOctree::createPolyMesh()
const partTet& elmt = tets[elmtI];
tessellationElement telmt(elmt[0], elmt[1], elmt[2], elmt[3]);
label faceI = 4 * elmtI;
for(label i=0;i<4;++i)
{
cells[elmtI][i] = faceI;
face& f = faces[faceI];
f.setSize ( 3 );
//- first face
cells[elmtI][0] = faceI;
const triFace tf = telmt.face(i);
f[0] = tf[0];
f[1] = tf[2];
f[2] = tf[1];
face& f0 = faces[faceI];
f0.setSize(3);
++faceI;
}
f0[0] = elmt.a();
f0[1] = elmt.c();
f0[2] = elmt.b();
++faceI;
//- second face
cells[elmtI][1] = faceI;
face& f1 = faces[faceI];
f1.setSize(3);
f1[0] = elmt.a();
f1[1] = elmt.b();
f1[2] = elmt.d();
++faceI;
//- third face
cells[elmtI][2] = faceI;
face& f2 = faces[faceI];
f2.setSize ( 3 );
f2[0] = elmt.b();
f2[1] = elmt.c();
f2[2] = elmt.d();
++faceI;
//- fourth face
cells[elmtI][3] = faceI;
face& f3 = faces[faceI];
f3.setSize ( 3 );
f3[0] = elmt.c();
f3[1] = elmt.a();
f3[2] = elmt.d();
}
# ifdef USE_OMP
......
......@@ -32,8 +32,6 @@ Description
#include "meshOctreeCreator.H"
#include "meshOctreeAutomaticRefinement.H"
#include "tetMeshExtractorOctree.H"
#include "delaunayTessellation.H"
#include "subdivisionTessellation.H"
#include "meshSurfaceEngine.H"
#include "meshSurfaceMapper.H"
#include "meshSurfaceEdgeExtractorNonTopo.H"
......
......@@ -47,7 +47,6 @@ label boundaryLayers::findNewNodeLabel
if( it != otherVrts_.end() )
{
const std::map<std::pair<label, label>, label>& m = it->second;
std::map<std::pair<label, label>, label>::const_iterator mit;
......
......@@ -440,8 +440,6 @@ void partTriMesh::createBufferLayers()
void partTriMesh::updateBufferLayers()
{
returnReduce(1, sumOp<label>());
const pointField& points = surf_.points();
const labelLongList& bufferLayerPoints = this->bufferLayerPoints();
const VRWGraph& pProcs = this->pointAtProcs();
......@@ -489,8 +487,6 @@ void partTriMesh::updateBufferLayers()
lp.coordinates()
);
}
returnReduce(1, sumOp<label>());
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -96,7 +96,6 @@ Ostream& boundaryPatch::operator<<(Ostream& os) const
Istream& boundaryPatch::operator>>(Istream& is)
{
Info << "Here" << endl;
token t;
is >> name_ >> t;
is >> t >> type_ >> t;
......
......@@ -475,8 +475,7 @@ void meshOctreeCreator::createOctreeBoxes()
//- make sure that INSIDE and UNKNOWN neighbours of DATA boxes
//- have the same or higher refinement level
//if( !refineBoxesRefinementDistance() )
refineBoxesNearDataBoxes(1);
refineBoxesNearDataBoxes(1);
//- distribute octree such that each processor has the same number
//- of leaf boxes which will be used as mesh cells
......
......@@ -130,6 +130,7 @@ public:
const direction nLayers = 1
) const;
<<<<<<< HEAD
//- mark additional layers around the leaves selected for refinement
//- given on a box-by-box basis
//- returns the number of boxes selected for refinement
......@@ -140,6 +141,8 @@ public:
List<direction>& targetRefLevel
) const;
=======
>>>>>>> e0f8dbd... Initial commit
//- refine leaves marked for refinement
//- hexRefinement is activated when it is required to refine all
//- sons of the same father, if a single son gets marked for refinement
......
......@@ -101,7 +101,6 @@ class meshOptimizer
//- new position is the average of the neighbouring vertices
void laplacian(const labelLongList&, const label);
void laplacianSurface(const labelLongList&, const label);
void laplacianParallel
(
const labelLongList& procPoints,
......
......@@ -538,8 +538,6 @@ bool meshSurfaceOptimizer::untangleSurface
bool meshSurfaceOptimizer::untangleSurface(const label nAdditionalLayers)
{
returnReduce(1, sumOp<label>());
labelLongList selectedPts(surfaceEngine_.boundaryPoints().size());
forAll(selectedPts, i)
selectedPts[i] = i;
......@@ -739,7 +737,6 @@ void meshSurfaceOptimizer::optimizeSurface2D(const label nIterations)
{
Info << "." << flush;
//smoothLaplacianFC(movedPoints, procBndPoints, false);
smoothSurfaceOptimizer(movedPoints);
//- move the points which are not at minimum z coordinate
......
......@@ -1806,7 +1806,6 @@ bool edgeExtractor::checkFacePatchesTopology()
facePatch_.transfer(newBoundaryPatches);
}
} while( nCorrected != 0 && (nIter++ < 3) );
return changed;
......
......@@ -80,7 +80,11 @@ void meshSurfaceMapper2D::findMappingDistance
}
//- safety factor
<<<<<<< HEAD
mIter->second *= 16.0;
=======
mIter->second *= 4.0;
>>>>>>> e0f8dbd... Initial commit
}
if( Pstream::parRun() )
......@@ -420,7 +424,11 @@ void meshSurfaceMapper2D::mapCorners(const labelLongList& edgesToMap)
scalar distSqApprox;
label iter(0);
<<<<<<< HEAD
while( iter++ < 40 )
=======
while( iter++ < 20 )
>>>>>>> e0f8dbd... Initial commit
{
point newP(vector::zero);
forAll(ePatches, epI)
......
......@@ -26,7 +26,6 @@ Description
\*---------------------------------------------------------------------------*/
#include "tetCreatorOctree.H"
#include "tetTessellation.H"
#include "meshOctree.H"
#include "triSurface.H"
......
......@@ -30,7 +30,9 @@ Description
#include "triSurfaceDetectPlanarRegions.H"
#include "demandDrivenData.H"
# ifdef USE_OMP
#include <omp.h>
# endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -5,9 +5,13 @@
runApplication preparePar
runParallel cartesianMesh 4
runParallel checkMesh 4
<<<<<<< HEAD
if [ "$WM_PROJECT" = "OpenFOAM" ]
then
runApplication reconstructParMesh -constant -fullMatch
else
runApplication reconstructParMesh -zeroTime
fi
=======
runApplication reconstructParMesh -zeroTime
>>>>>>> e0f8dbd... Initial commit
/*---------------------------------------------------------------------------*\
========= |
\\ / 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
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<labelledTri>& 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<counter;++selI)
{
//- read selection name
word selName;
inFile >> selName;
//- read selection type
label selType;
inFile >> selType;
//- read selection entries
label size;
inFile >> size;
labelLongList entries(size);
for(label i=0;i<size;++i)
inFile >> 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;
}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / 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
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<labelledTri>& 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<counter;++selI)
{
//- read selection name
word selName;
inFile >> selName;
//- read selection type
label selType;
inFile >> selType;
//- read selection entries
label size;
inFile >> size;
labelLongList entries(size);
for(label i=0;i<size;++i)
inFile >> 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;
}
// ************************************************************************* //
EXE_INC = \
-I../../meshLibrary/lnInclude \
-I$(FOAM_SRC)/triSurface/lnInclude
-I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/meshTools/lnIncludet
EXE_LIBS = \
-ltriSurface \
......
/*---------------------------------------------------------------------------*\
========= |
\\ / 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
Reads the AVL's surface mesh
\*---------------------------------------------------------------------------*/