From ec257834101f4d35f338a12fc9a3a8cb62c1b348 Mon Sep 17 00:00:00 2001
From: mattijs <mattijs>
Date: Mon, 26 Mar 2012 12:17:46 +0100
Subject: [PATCH] ENH: splitMeshRegions, autoHexMesh: allocate face-decomp
 structure before doing findCell

---
 .../mesh/manipulation/splitMeshRegions/splitMeshRegions.C    | 4 +++-
 .../refinementParameters/refinementParameters.C              | 5 ++++-
 .../autoMesh/autoHexMesh/meshRefinement/meshRefinement.C     | 5 ++++-
 .../autoHexMesh/meshRefinement/meshRefinementBaffles.C       | 5 ++++-
 4 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C
index b34676fac5c..d129efde6de 100644
--- a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C
+++ b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2012 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -2194,6 +2194,8 @@ int main(int argc, char *argv[])
 
             label regionI = -1;
 
+            (void)mesh.tetBasePtIs();
+
             label cellI = mesh.findCell(insidePoint);
 
             Info<< nl << "Found point " << insidePoint << " in cell " << cellI
diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/refinementParameters/refinementParameters.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/refinementParameters/refinementParameters.C
index ba8d0f4200e..ab2140a4ec7 100644
--- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/refinementParameters/refinementParameters.C
+++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/refinementParameters/refinementParameters.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2012 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -76,6 +76,9 @@ Foam::refinementParameters::refinementParameters(const dictionary& dict)
 Foam::labelList Foam::refinementParameters::findCells(const polyMesh& mesh)
  const
 {
+    // Force calculation of tet-diag decomposition (for use in findCell)
+    (void)mesh.tetBasePtIs();
+
     // Global calculation engine
     globalIndex globalCells(mesh.nCells());
 
diff --git a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C
index 79df04781e8..5503e6d2a8f 100644
--- a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C
+++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2012 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -1819,6 +1819,9 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMeshRegions
     const point& keepPoint
 )
 {
+    // Force calculation of face decomposition (used in findCell)
+    (void)mesh_.tetBasePtIs();
+
     // Determine connected regions. regionSplit is the labelList with the
     // region per cell.
     regionSplit cellRegion(mesh_);
diff --git a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C
index c6877bbd8d1..5ec90659554 100644
--- a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C
+++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2012 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -1235,6 +1235,9 @@ void Foam::meshRefinement::findCellZoneInsideWalk
     blockedFace.clear();
 
 
+    // Force calculation of face decomposition (used in findCell)
+    (void)mesh_.tetBasePtIs();
+
     // For all locationSurface find the cell
     forAll(locationSurfaces, i)
     {
-- 
GitLab