STYLE: Code cleanup and add some comments

This commit is contained in:
laurence
2013-01-10 10:50:05 +00:00
parent 51db019bee
commit ff3654956a
9 changed files with 96 additions and 92 deletions

View File

@ -17,7 +17,7 @@ FoamFile
collapseEdgesCoeffs collapseEdgesCoeffs
{ {
// Edges shorter than this absolute value will be merged // Edges shorter than this absolute value will be merged
minimumEdgeLength 1e-8; minimumEdgeLength 1e-6;
// The maximum angle between two edges that share a point attached to // The maximum angle between two edges that share a point attached to
// no other edges // no other edges
@ -25,7 +25,7 @@ collapseEdgesCoeffs
// The amount that minimumEdgeLength will be reduced by for each // The amount that minimumEdgeLength will be reduced by for each
// edge if that edge's collapse generates a poor quality face // edge if that edge's collapse generates a poor quality face
reductionFactor 0.5; reductionFactor 0.5;
} }
@ -67,14 +67,17 @@ meshQualityCoeffs
{ {
// Name of the dictionary that has the mesh quality coefficients used // Name of the dictionary that has the mesh quality coefficients used
// by motionSmoother::checkMesh // by motionSmoother::checkMesh
meshQualityCoeffDict meshQualityDict; #include "meshQualityDict";
// Maximum number of smoothing iterations for the reductionFactors
maximumSmoothingIterations 2;
// Maximum number of outer iterations is mesh quality checking is enabled // Maximum number of outer iterations is mesh quality checking is enabled
maximumIterations 10; maximumIterations 10;
// Maximum number of iterations deletion of a point can cause a bad face // Maximum number of iterations deletion of a point can cause a bad face
// to be constructed before it is forced to not be deleted // to be constructed before it is forced to not be deleted
maxPointErrorCount 5; maxPointErrorCount 5;
} }

View File

@ -1,5 +1,4 @@
EXE_INC = \ EXE_INC = \
/* -DFULLDEBUG -g -O0 */ \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \

View File

@ -26,12 +26,6 @@ License
#include "patchToPoly2DMesh.H" #include "patchToPoly2DMesh.H"
#include "PatchTools.H" #include "PatchTools.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::patchToPoly2DMesh::flipFaceOrder() void Foam::patchToPoly2DMesh::flipFaceOrder()
@ -275,12 +269,9 @@ void Foam::patchToPoly2DMesh::createPolyMeshComponents()
addPatchFacesToOwner(); addPatchFacesToOwner();
} }
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
//- Construct from a primitivePatch
Foam::patchToPoly2DMesh::patchToPoly2DMesh Foam::patchToPoly2DMesh::patchToPoly2DMesh
( (
const MeshedSurface<face>& patch, const MeshedSurface<face>& patch,
@ -321,13 +312,5 @@ void Foam::patchToPoly2DMesh::createMesh()
} }
} }
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * //
// ************************************************************************* // // ************************************************************************* //

View File

@ -51,6 +51,7 @@ class patchToPoly2DMesh
{ {
// Private data // Private data
// Reference to the meshed surface
const MeshedSurface<face>& patch_; const MeshedSurface<face>& patch_;
const wordList& patchNames_; const wordList& patchNames_;
@ -62,11 +63,16 @@ class patchToPoly2DMesh
const EdgeMap<label>& mapEdgesRegion_; const EdgeMap<label>& mapEdgesRegion_;
pointField points_; pointField points_;
faceList faces_; faceList faces_;
labelList owner_; labelList owner_;
labelList neighbour_; labelList neighbour_;
//- Description of data_
// Private Member Functions
void flipFaceOrder(); void flipFaceOrder();
void createNeighbours(); void createNeighbours();
@ -79,9 +85,6 @@ class patchToPoly2DMesh
void createPolyMeshComponents(); void createPolyMeshComponents();
// Private Member Functions
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct
patchToPoly2DMesh(const patchToPoly2DMesh&); patchToPoly2DMesh(const patchToPoly2DMesh&);
@ -110,47 +113,47 @@ public:
// Member Functions // Member Functions
// Access // Access
pointField& points()
{
return points_;
}
faceList& faces() pointField& points()
{ {
return faces_; return points_;
} }
labelList& owner() faceList& faces()
{ {
return owner_; return faces_;
} }
labelList& neighbour() labelList& owner()
{ {
return neighbour_; return owner_;
} }
const wordList& patchNames() const labelList& neighbour()
{ {
return patchNames_; return neighbour_;
} }
const labelList& patchSizes() const const wordList& patchNames() const
{ {
return patchSizes_; return patchNames_;
} }
const labelList& patchSizes() const
{
return patchSizes_;
}
const labelList& patchStarts() const
{
return patchStarts_;
}
const labelList& patchStarts() const
{
return patchStarts_;
}
// Check
// Edit // Edit
void createMesh();
// Write
//- Create the mesh
void createMesh();
}; };

View File

@ -317,12 +317,12 @@ int main(int argc, char *argv[])
} }
// Take over refinement levels and write to new time directory. // Take over refinement levels and write to new time directory.
Pout<< "\nWriting extruded mesh to time = " << runTimeExtruded.timeName() Info<< "\nWriting extruded mesh to time = " << runTimeExtruded.timeName()
<< nl << endl; << nl << endl;
mesh().write(); mesh().write();
Pout<< "End\n" << endl; Info<< "End\n" << endl;
return 0; return 0;
} }

View File

@ -2,31 +2,31 @@
#define CGAL_PSURF_RINGS_H_ #define CGAL_PSURF_RINGS_H_
// This file adapted from // This file adapted from
// CGAL-3.7/examples/Jet_fitting_3//PolyhedralSurf_rings.h // CGAL-4.0/examples/Jet_fitting_3/PolyhedralSurf_rings.h
// Licensed under CGAL-3.7/LICENSE.FREE_USE // Licensed under CGAL-4.0/LICENSE.FREE_USE
// Copyright (c) 1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007 // Copyright (c) 1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007
// Utrecht University (The Netherlands), ETH Zurich (Switzerland), Freie // Utrecht University (The Netherlands),
// Universitaet Berlin (Germany), INRIA Sophia-Antipolis (France), // ETH Zurich (Switzerland),
// Martin-Luther-University Halle-Wittenberg (Germany), Max-Planck-Institute // INRIA Sophia-Antipolis (France),
// Saarbruecken (Germany), RISC Linz (Austria), and Tel-Aviv University // Max-Planck-Institute Saarbruecken (Germany),
// (Israel). All rights reserved. // and Tel-Aviv University (Israel). All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a
// of this software and associated documentation files (the "Software"), to deal // copy of this software and associated documentation files (the
// in the Software without restriction, including without limitation the rights // "Software"), to deal in the Software without restriction, including
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // without limitation the rights to use, copy, modify, merge, publish,
// copies of the Software, and to permit persons to whom the Software is // distribute, sublicense, and/or sell copies of the Software, and to
// furnished to do so, subject to the following conditions: // permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR //
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// SOFTWARE. // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <cassert> #include <cassert>

View File

@ -25,7 +25,8 @@ Class
Foam::dynamicIndexedOctree Foam::dynamicIndexedOctree
Description Description
Non-pointer based hierarchical recursive searching Non-pointer based hierarchical recursive searching.
Storage is dynamic, so elements can be deleted.
SourceFiles SourceFiles
dynamicIndexedOctree.C dynamicIndexedOctree.C
@ -451,6 +452,7 @@ public:
); );
} }
// Member Functions // Member Functions
// Access // Access
@ -656,6 +658,7 @@ public:
label removeIndex(const label nodIndex, const label index); label removeIndex(const label nodIndex, const label index);
// Write // Write
//- Print tree. Either print all indices (printContent = true) or //- Print tree. Either print all indices (printContent = true) or
@ -671,6 +674,7 @@ public:
void writeTreeInfo() const; void writeTreeInfo() const;
// IOstream Operators // IOstream Operators
friend Ostream& operator<< <Type> friend Ostream& operator<< <Type>

View File

@ -25,6 +25,10 @@ Class
Foam::polyMeshFilter Foam::polyMeshFilter
Description Description
Filter the edges and faces of a polyMesh whilst satisfying the given mesh
quality criteria.
Works on a copy of the mesh.
SourceFiles SourceFiles
polyMeshFilter.C polyMeshFilter.C
@ -102,10 +106,10 @@ class polyMeshFilter
// faces // faces
const scalar faceReductionFactor_; const scalar faceReductionFactor_;
//- //- Maximum number of times a deleted point can be associated with the
// creation of a bad face it is forced to be kept.
const label maxPointErrorCount_; const label maxPointErrorCount_;
//- The minimum edge length for each edge //- The minimum edge length for each edge
scalarField minEdgeLen_; scalarField minEdgeLen_;
@ -225,6 +229,7 @@ public:
//- Filter edges only. //- Filter edges only.
label filterEdges(const label nOriginalBadFaces); label filterEdges(const label nOriginalBadFaces);
//- Filter all faces that are in the face zone indirectPatchFaces
label filterIndirectPatchFaces(); label filterIndirectPatchFaces();
}; };

View File

@ -61,7 +61,7 @@ class face;
class edge; class edge;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class edgeCollapser Declaration Class edgeCollapser Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class edgeCollapser class edgeCollapser
@ -84,12 +84,18 @@ private:
//- Reference to mesh //- Reference to mesh
const polyMesh& mesh_; const polyMesh& mesh_;
//- Controls collapse of a face to an edge
const scalar guardFraction_; const scalar guardFraction_;
//- Only collapse face to a point if high aspect ratio
const scalar maxCollapseFaceToPointSideLengthCoeff_; const scalar maxCollapseFaceToPointSideLengthCoeff_;
//- Allow a face to be collapsed to a point early, before the test
// to collapse to an edge
const Switch allowEarlyCollapseToPoint_; const Switch allowEarlyCollapseToPoint_;
//- Fraction of maxCollapseFaceToPointSideLengthCoeff_ to use when
// allowEarlyCollapseToPoint_ is on
const scalar allowEarlyCollapseCoeff_; const scalar allowEarlyCollapseCoeff_;
@ -266,8 +272,8 @@ public:
const dictionary& meshQualityDict const dictionary& meshQualityDict
); );
// Check mesh and mark points on faces in error //- Check mesh and mark points on faces in error
// Returns boolList with points in error set // Returns boolList with points in error set
static label checkMeshQuality static label checkMeshQuality
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -300,7 +306,7 @@ public:
polyTopoChange& meshMod polyTopoChange& meshMod
) const; ) const;
// Mark (in collapseEdge) any edges to collapse //- Mark (in collapseEdge) any edges to collapse
label markSmallEdges label markSmallEdges
( (
const scalarField& minEdgeLen, const scalarField& minEdgeLen,
@ -309,7 +315,7 @@ public:
Map<point>& collapsePointToLocation Map<point>& collapsePointToLocation
) const; ) const;
// Mark (in collapseEdge) any edges to merge //- Mark (in collapseEdge) any edges to merge
label markMergeEdges label markMergeEdges
( (
const scalar maxCos, const scalar maxCos,
@ -332,6 +338,7 @@ public:
Map<point>& collapsePointToLocation Map<point>& collapsePointToLocation
) const; ) const;
//- Marks edges in the faceZone indirectPatchFaces for collapse
void markIndirectPatchFaces void markIndirectPatchFaces
( (
PackedBoolList& collapseEdge, PackedBoolList& collapseEdge,