Skip to content

Commit 7a55c70

Browse files
author
Henry Weller
committed
snappyHexMesh: Changed movePoints -> setPoints
Avoids the unnecessary calculation of the swept volumes and caching of old-time points, volumes etc. Provides cleaner and faster code.
1 parent c9c5af6 commit 7a55c70

File tree

8 files changed

+9
-68
lines changed

8 files changed

+9
-68
lines changed

applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,6 @@ label mergePatchFaces
106106

107107
// Update fields
108108
mesh.topoChange(map);
109-
110-
// Delete mesh volumes. No other way to do this?
111-
mesh.clearOut();
112109
}
113110

114111

@@ -245,9 +242,6 @@ label mergePatchFaces
245242

246243
// Update fields
247244
mesh.topoChange(map);
248-
249-
// Delete mesh volumes. No other way to do this?
250-
mesh.clearOut();
251245
}
252246
}
253247
else
@@ -290,9 +284,6 @@ label mergeEdges(const scalar minCos, polyMesh& mesh)
290284

291285
// Update fields
292286
mesh.topoChange(map);
293-
294-
// Delete mesh volumes. No other way to do this?
295-
mesh.clearOut();
296287
}
297288
else
298289
{

src/mesh/snappyHexMesh/meshRefinement/meshRefinement.C

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -631,9 +631,6 @@ Foam::autoPtr<Foam::polyTopoChangeMap> Foam::meshRefinement::doRemoveCells
631631
// Update fields
632632
mesh_.topoChange(map);
633633

634-
// Delete mesh volumes. No other way to do this?
635-
mesh_.clearOut();
636-
637634
// Reset the instance for if in overwrite mode
638635
mesh_.setInstance(name());
639636
setInstance(mesh_.facesInstance());
@@ -762,9 +759,6 @@ Foam::autoPtr<Foam::polyTopoChangeMap> Foam::meshRefinement::splitFaces
762759
// Update fields
763760
mesh_.topoChange(map);
764761

765-
// Delete mesh volumes. No other way to do this?
766-
mesh_.clearOut();
767-
768762
// Reset the instance for if in overwrite mode
769763
mesh_.setInstance(name());
770764
setInstance(mesh_.facesInstance());

src/mesh/snappyHexMesh/meshRefinement/meshRefinementBaffles.C

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -368,9 +368,6 @@ Foam::autoPtr<Foam::polyTopoChangeMap> Foam::meshRefinement::createBaffles
368368
// Update fields
369369
mesh_.topoChange(map);
370370

371-
// Delete mesh volumes.
372-
mesh_.clearOut();
373-
374371
// Reset the instance for if in overwrite mode
375372
mesh_.setInstance(name());
376373

@@ -886,9 +883,6 @@ Foam::autoPtr<Foam::polyTopoChangeMap> Foam::meshRefinement::mergeBaffles
886883
// Update fields
887884
mesh_.topoChange(map);
888885

889-
// Delete mesh volumes.
890-
mesh_.clearOut();
891-
892886
// Reset the instance for if in overwrite mode
893887
mesh_.setInstance(name());
894888

@@ -2667,9 +2661,6 @@ Foam::meshRefinement::dupNonManifoldPoints
26672661
// Update fields
26682662
mesh_.topoChange(map);
26692663

2670-
// Delete mesh volumes.
2671-
mesh_.clearOut();
2672-
26732664
// Reset the instance for if in overwrite mode
26742665
mesh_.setInstance(name());
26752666

@@ -3281,9 +3272,6 @@ Foam::autoPtr<Foam::polyTopoChangeMap> Foam::meshRefinement::zonify
32813272
// Update fields
32823273
mesh_.topoChange(map);
32833274

3284-
// Delete mesh volumes.
3285-
mesh_.clearOut();
3286-
32873275
// Reset the instance for if in overwrite mode
32883276
mesh_.setInstance(name());
32893277

src/mesh/snappyHexMesh/meshRefinement/meshRefinementMerge.C

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,6 @@ License
9797
// // Update fields
9898
// mesh_.topoChange(map);
9999
//
100-
// // Delete mesh volumes. No other way to do this?
101-
// mesh_.clearOut();
102-
//
103100
// // Reset the instance for if in overwrite mode
104101
// mesh_.setInstance(name());
105102
//
@@ -187,9 +184,6 @@ License
187184
// // Update fields
188185
// mesh_.topoChange(map);
189186
//
190-
// // Delete mesh volumes. No other way to do this?
191-
// mesh_.clearOut();
192-
//
193187
// // Reset the instance for if in overwrite mode
194188
// mesh_.setInstance(name());
195189
//
@@ -323,9 +317,6 @@ Foam::label Foam::meshRefinement::mergePatchFacesUndo
323317
// Update fields
324318
mesh_.topoChange(map);
325319

326-
// Delete mesh volumes.
327-
mesh_.clearOut();
328-
329320
// Reset the instance for if in overwrite mode
330321
mesh_.setInstance(name());
331322

@@ -504,9 +495,6 @@ Foam::label Foam::meshRefinement::mergePatchFacesUndo
504495
// Update fields
505496
mesh_.topoChange(map);
506497

507-
// Delete mesh volumes.
508-
mesh_.clearOut();
509-
510498
// Reset the instance for if in overwrite mode
511499
mesh_.setInstance(name());
512500

@@ -580,9 +568,6 @@ Foam::autoPtr<Foam::polyTopoChangeMap> Foam::meshRefinement::doRemovePoints
580568
// Update fields
581569
mesh_.topoChange(map);
582570

583-
// Delete mesh volumes.
584-
mesh_.clearOut();
585-
586571
// Reset the instance for if in overwrite mode
587572
mesh_.setInstance(name());
588573

@@ -644,9 +629,6 @@ Foam::autoPtr<Foam::polyTopoChangeMap> Foam::meshRefinement::doRestorePoints
644629
// Update fields
645630
mesh_.topoChange(map);
646631

647-
// Delete mesh volumes.
648-
mesh_.clearOut();
649-
650632
// Reset the instance for if in overwrite mode
651633
mesh_.setInstance(name());
652634

src/mesh/snappyHexMesh/meshRefinement/meshRefinementProblemCells.C

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
========= |
33
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
44
\\ / O peration | Website: https://openfoam.org
5-
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
5+
\\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
66
\\/ M anipulation |
77
-------------------------------------------------------------------------------
88
License
@@ -672,7 +672,7 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCells
672672
{
673673
const_cast<Time&>(mesh_.time())++;
674674
pointField oldPoints(mesh_.points());
675-
mesh_.movePoints(newPoints);
675+
mesh_.setPoints(newPoints);
676676
Pout<< "Writing newPoints mesh to time " << name()
677677
<< endl;
678678
write
@@ -681,7 +681,7 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCells
681681
writeType(writeLevel() | WRITEMESH),
682682
mesh_.time().path()/"newPoints"
683683
);
684-
mesh_.movePoints(oldPoints);
684+
mesh_.setPoints(oldPoints);
685685
}
686686
}
687687

@@ -1151,7 +1151,7 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCellsGeometric
11511151
vector(great, great, great) // null value (note: cannot use vGreat)
11521152
);
11531153

1154-
mesh_.movePoints(newPoints);
1154+
mesh_.setPoints(newPoints);
11551155
}
11561156

11571157

@@ -1278,7 +1278,7 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCellsGeometric
12781278

12791279

12801280
// Restore points.
1281-
mesh_.movePoints(oldPoints);
1281+
mesh_.setPoints(oldPoints);
12821282

12831283

12841284
Info<< "markFacesOnProblemCellsGeometric : marked "

src/mesh/snappyHexMesh/meshRefinement/meshRefinementRefine.C

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2247,9 +2247,6 @@ Foam::autoPtr<Foam::polyTopoChangeMap> Foam::meshRefinement::refine
22472247
// Update fields
22482248
mesh_.topoChange(map);
22492249

2250-
// Delete mesh volumes.
2251-
mesh_.clearOut();
2252-
22532250
// Reset the instance for if in overwrite mode
22542251
mesh_.setInstance(name());
22552252

src/mesh/snappyHexMesh/motionSmoother/motionSmootherAlgo.C

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
========= |
33
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
44
\\ / O peration | Website: https://openfoam.org
5-
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
5+
\\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
66
\\/ M anipulation |
77
-------------------------------------------------------------------------------
88
License
@@ -894,7 +894,7 @@ bool Foam::motionSmootherAlgo::scaleMesh
894894
pointField newPoints(curPoints());
895895

896896
// Move. No need to do 2D correction since curPoints already done that.
897-
mesh_.movePoints(newPoints);
897+
mesh_.setPoints(newPoints);
898898
movePoints();
899899

900900

src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyLayerDriver.C

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,6 +1043,7 @@ void Foam::snappyLayerDriver::determineSidePatches
10431043
}
10441044

10451045
mesh.clearOut();
1046+
10461047
const_cast<polyBoundaryMesh&>(mesh.boundaryMesh()).topoChange();
10471048
}
10481049
}
@@ -3256,9 +3257,6 @@ void Foam::snappyLayerDriver::addLayers
32563257
Info<< "Writing shrunk mesh to time "
32573258
<< meshRefiner_.name() << endl;
32583259

3259-
// See comment in snappySnapDriver why we should not remove
3260-
// meshPhi using mesh.clearOut().
3261-
32623260
meshRefiner_.write
32633261
(
32643262
meshRefinement::debugType(debug),
@@ -3482,7 +3480,7 @@ void Foam::snappyLayerDriver::addLayers
34823480
}
34833481

34843482
// Reset mesh points and start again
3485-
mesh.movePoints(oldPoints);
3483+
mesh.setPoints(oldPoints);
34863484
pp().clearGeom();
34873485

34883486
// Grow out region of non-extrusion
@@ -3508,15 +3506,9 @@ void Foam::snappyLayerDriver::addLayers
35083506
// Apply the stored topo changes to the current mesh.
35093507
autoPtr<polyTopoChangeMap> map = savedMeshMod.changeMesh(mesh);
35103508

3511-
// Hack to remove meshPhi/V0 - mapped incorrectly. TBD.
3512-
mesh.clearOut();
3513-
35143509
// Update fields
35153510
mesh.topoChange(map);
35163511

3517-
// Delete mesh volumes.
3518-
mesh.clearOut();
3519-
35203512
// Reset the instance for if in overwrite mode
35213513
mesh.setInstance(meshRefiner_.name());
35223514

@@ -3569,9 +3561,6 @@ void Foam::snappyLayerDriver::addLayers
35693561
const_cast<Time&>(mesh.time())++;
35703562
}
35713563

3572-
// Hack to remove meshPhi/V0 - mapped incorrectly. TBD.
3573-
mesh.clearOut();
3574-
35753564
// Balance. No restriction on face zones and baffles.
35763565
autoPtr<polyDistributionMap> map = meshRefiner_.balance
35773566
(

0 commit comments

Comments
 (0)