Go to the documentation of this file.
78 # pragma omp parallel for if( tets.size() > 100 ) \
83 invertedTets[tetI] =
false;
86 invertedTets[tetI] =
true;
89 label nIter(0), nNegative, nNegativeBefore;
97 # pragma omp parallel for if( tets.size() > 100 ) \
98 schedule(dynamic, 10) reduction(+ : nNegative)
100 forAll(invertedTets, tetI)
102 if( invertedTets[tetI] )
105 const partTet& tet = tets[tetI];
107 for(
label i=0;i<4;++i)
108 negativeNode[tet[i]] =
true;
124 # pragma omp parallel if( smoothVertex.size() > 100 )
130 newPositions.
setSize(omp_get_num_threads());
142 # pragma omp for schedule(dynamic, 10)
144 forAll(smoothVertex, nodeI)
148 !negativeNode[nodeI] ||
164 newPositions.
clear();
174 nNegativeBefore = nNegative;
178 # pragma omp parallel for if( tets.size() > 100 ) \
179 schedule(dynamic, 10) reduction(+ : nNegative)
183 helper[tetI] =
false;
185 if( invertedTets[tetI] && (tets[tetI].
mag(
points) < VSMALL) )
189 const partTet& tet = tets[tetI];
191 for(
label i=0;i<4;++i)
192 negativeNode[tet[i]] =
true;
201 }
while( (nNegative < nNegativeBefore) || (++nIter < nIterations) );
214 # pragma omp parallel for if( tets.size() > 100 ) \
215 schedule(dynamic, 10)
219 invertedTets[tetI] =
false;
222 invertedTets[tetI] =
true;
225 label nIter(0), nNegative, nNegativeBefore;
231 negativeNode =
false;
233 # pragma omp parallel for if( tets.size() > 100 ) \
234 schedule(dynamic, 10) reduction(+ : nNegative)
236 forAll(invertedTets, tetI)
238 if( invertedTets[tetI] )
241 const partTet& tet = tets[tetI];
243 for(
label i=0;i<4;++i)
244 negativeNode[tet[i]] =
true;
260 # pragma omp parallel if( smoothVertex.size() > 100 )
266 newPositions.
setSize(omp_get_num_threads());
278 # pragma omp for schedule(dynamic, 10)
280 forAll(smoothVertex, nodeI)
282 if( !negativeNode[nodeI] )
299 newPositions.
clear();
309 nNegativeBefore = nNegative;
312 # pragma omp parallel for if( tets.size() > 100 ) \
313 schedule(dynamic, 10) reduction(+ : nNegative)
317 helper[tetI] =
false;
319 if( invertedTets[tetI] && (tets[tetI].
mag(
points) < VSMALL) )
322 const partTet& tet = tets[tetI];
324 for(
label i=0;i<4;++i)
325 negativeNode[tet[i]] =
true;
334 }
while( (nNegative < nNegativeBefore) || (++nIter < nIterations) );
342 for(
label i=0;i<nIterations;++i)
347 # pragma omp parallel if( smoothVertex.size() > 100 )
353 newPositions.
setSize(omp_get_num_threads());
365 # pragma omp for schedule(dynamic, 10)
367 forAll(smoothVertex, nodeI)
386 newPositions.
clear();
398 const label nIterations,
399 const bool nonShrinking
406 label nThreads = omp_get_num_procs();
407 if( smoothVertex.
size() < 100 )
410 const label nThreads(1);
413 for(
label i=0;i<nIterations;++i)
418 # pragma omp parallel num_threads(nThreads)
428 # pragma omp for schedule(dynamic, 5)
430 forAll(smoothVertex, nodeI)
452 const partTet& tet = tets[tetI];
453 for(
label i=0;i<3;++i)
455 edge e(tet[i], tet[(i+1)%3]);
465 ++numAppearances(
pos);
474 if( numAppearances[beI] != 1 )
479 pts[bEdges[beI].start()],
480 pts[bEdges[beI].end()],
485 n /= (
mag(
n) + VSMALL);
495 if(
mag(ev[2]) > (
mag(ev[1]) +
mag(ev[0])) )
502 else if(
mag(ev[1]) > 0.5 * (
mag(ev[2]) +
mag(ev[0])) )
506 normal1 /= (
mag(normal1)+VSMALL);
508 normal2 /= (
mag(normal2)+VSMALL);
510 vector eVec = normal1 ^ normal2;
511 eVec /= (
mag(eVec) + VSMALL);
513 disp = (disp & eVec) * eVec;
534 tetMesh_.updateVerticesSMP(newPositions);
535 newPositions.
clear();
539 updateBufferLayerPoints();
540 unifyCoordinatesParallel();
547 const label nIterations
553 label nThreads = omp_get_num_procs();
554 if( smoothVertex.
size() < 1000 )
557 const label nThreads(1);
560 for(
label i=0;i<nIterations;++i)
565 # pragma omp parallel num_threads(nThreads)
570 newPositions[omp_get_thread_num()];
576 # pragma omp for schedule(dynamic, 5)
578 forAll(smoothVertex, nodeI)
596 const partTet& tet = tets[tetI];
597 for(
label i=0;i<3;++i)
599 const edge e(tet[i], tet[(i+1)%3]);
609 ++numAppearances(
pos);
618 if( numAppearances[beI] != 1 )
623 pts[bndEdges[beI].start()],
624 pts[bndEdges[beI].end()],
642 tetMesh_.updateVerticesSMP(newPositions);
643 newPositions.
clear();
647 updateBufferLayerPoints();
648 unifyCoordinatesParallel();
void optimiseUsingKnuppMetric(const label nInterations=5)
untangle mesh by using Patrik Knupp's simple metric
dimensionedSymmTensor symm(const dimensionedSymmTensor &dt)
void append(const T &e)
Append an element at the end of the list.
#define forAll(list, i)
Loop across all elements in list.
void optimiseBoundaryVolumeOptimizer(const label nIterations=3, const bool nonShrinking=false)
smooth boundary using the volume optimizer
Template functions to aid in the implementation of demand driven data.
static bool & parRun()
Is this a parallel run?
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
void optimizeNodePosition(const scalar tol=0.001)
label size() const
Size of the active part of the list.
void optimiseUsingMeshUntangler(const label nIerations=5)
smooth using mesh untangler
dimensioned< scalar > mag(const dimensioned< Type > &)
tetMeshOptimisation(partTetMesh &mesh)
Construct from tet mesh.
const DynList< partTet, 128 > & tets() const
return tets
Point centre() const
Return centre (centroid)
partTetMesh & tetMesh_
reference to the tet mesh
A triangle primitive used to calculate face normals and swept volumes.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
vector normal() const
Return vector normal.
vector eigenVector(const tensor &, const scalar lambda)
dimensionedVector eigenValues(const dimensionedTensor &dt)
void optimiseBoundarySurfaceLaplace(const label nIterations=3)
smooth boundary using shrinking surface laplace
const LongList< partTet > & tets() const
class for volume optimizer
const point & centrePoint() const
return centre point coordinates
void optimizeNodePosition(const scalar tol=0.001)
find the best position for the node
static const SymmTensor zero
const double e
Elementary charge.
void optimizeNodePosition(const scalar tol=0.001)
void setSize(const label)
Reset size of List.
void updateBufferLayerPoints()
update buffer layer points
label containsAtPosition(const T &e) const
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void clear()
Clear the list, i.e. set size to zero.
void optimiseUsingVolumeOptimizer(const label nIterations=10)
smooth using volume optimizer
void unifyNegativePoints(boolList &negativeNode) const
void updateVerticesSMP(const List< LongList< labelledPoint > > &)
void size(const label)
Override size to be inconsistent with allocated storage.
const LongList< point > & points() const
access to points, tets and other data
const LongList< direction > & smoothVertex() const
DynList< point, 128 > & pts()
return points
void unifyCoordinatesParallel(const boolList *negativeNodePtr=NULL)
A normal distribution model.
void append(const T &e)
Append an element at the end of the list.
dimensionedScalar pos(const dimensionedScalar &ds)