reinstate stitchMesh functionality
authormattijs <mattijs>
Wed, 24 Jun 2009 12:05:39 +0000 (24 13:05 +0100)
committermattijs <mattijs>
Wed, 24 Jun 2009 12:07:38 +0000 (24 13:07 +0100)
applications/utilities/mesh/generation/blockMesh/blockMeshApp.C
applications/utilities/mesh/generation/blockMesh/mergePatchPairs.H [moved from applications/utilities/mesh/generation/blockMesh/mergePatchPairs.C with 98% similarity]
applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C
src/dynamicMesh/slidingInterface/coupleSlidingInterface.C
src/dynamicMesh/slidingInterface/decoupleSlidingInterface.C
src/dynamicMesh/slidingInterface/slidingInterface.C
src/dynamicMesh/slidingInterface/slidingInterface.H
src/dynamicMesh/slidingInterface/slidingInterfaceAttachedAddressing.C
src/dynamicMesh/slidingInterface/slidingInterfaceClearCouple.C
src/dynamicMesh/slidingInterface/slidingInterfaceProjectPoints.C
src/topoChangerFvMesh/Make/files

index e73a526..d1f271e 100644 (file)
@@ -235,14 +235,7 @@ int main(int argc, char *argv[])
             meshDict.lookup("mergePatchPairs")
         );
 
-        if (mergePatchPairs.size())
-        {
-            FatalErrorIn(args.executable())
-                << "mergePatchPairs not currently supported."
-                << exit(FatalError);
-        }
-
-        //#include "mergePatchPairs.H"
+        #include "mergePatchPairs.H"
     }
     else
     {
@@ -1,7 +1,7 @@
-        Info<< nl << "Creating merge patch pairs" << nl << endl;
-
         if (mergePatchPairs.size() > 0)
         {
+            Info<< nl << "Creating merge patch pairs" << nl << endl;
+
             // Create and add point and face zones and mesh modifiers
             List<pointZone*> pz(mergePatchPairs.size());
             List<faceZone*> fz(3*mergePatchPairs.size());
index e3c558c..8c730f8 100644 (file)
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -60,10 +60,10 @@ Description
 #include "polyTopoChanger.H"
 #include "mapPolyMesh.H"
 #include "ListOps.H"
-#include "IndirectList.H"
 #include "slidingInterface.H"
 #include "perfectInterface.H"
 #include "IOobjectList.H"
+#include "ReadFields.H"
 
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -91,34 +91,6 @@ void checkPatch(const polyBoundaryMesh& bMesh, const word& name)
 }
 
 
-// Read field
-template<class GeoField>
-void readFields
-(
-    const fvMesh& mesh,
-    const IOobjectList& objects,
-    PtrList<GeoField>& fields
-)
-{
-    // Search list of objects for volScalarFields
-    IOobjectList fieldObjects(objects.lookupClass(GeoField::typeName));
-
-    // Construct the vol scalar fields
-    fields.setSize(fieldObjects.size());
-
-    label fieldi = 0;
-    for
-    (
-        IOobjectList::iterator iter = fieldObjects.begin();
-        iter != fieldObjects.end();
-        ++iter
-    )
-    {
-        fields.set(fieldi++, new GeoField(*iter(), mesh));
-    }
-}
-
-
 // Main program:
 
 int main(int argc, char *argv[])
@@ -135,7 +107,9 @@ int main(int argc, char *argv[])
 
 #   include "setRootCase.H"
 #   include "createTime.H"
+    runTime.functionObjects().off();
 #   include "createMesh.H"
+    const word oldInstance = mesh.pointsInstance();
 
 
     word masterPatchName(args.additionalArgs()[0]);
@@ -342,7 +316,8 @@ int main(int argc, char *argv[])
                 cutZoneName,
                 masterPatchName,
                 slavePatchName,
-                tom                   // integral or partial
+                tom,                    // integral or partial
+                true                    // couple/decouple mode
             )
         );
     }
@@ -354,30 +329,30 @@ int main(int argc, char *argv[])
     // Read all current fvFields so they will get mapped
     Info<< "Reading all current volfields" << endl;
     PtrList<volScalarField> volScalarFields;
-    readFields(mesh, objects, volScalarFields);
+    ReadFields(mesh, objects, volScalarFields);
 
     PtrList<volVectorField> volVectorFields;
-    readFields(mesh, objects, volVectorFields);
+    ReadFields(mesh, objects, volVectorFields);
 
     PtrList<volSphericalTensorField> volSphericalTensorFields;
-    readFields(mesh, objects, volSphericalTensorFields);
+    ReadFields(mesh, objects, volSphericalTensorFields);
 
     PtrList<volSymmTensorField> volSymmTensorFields;
-    readFields(mesh, objects, volSymmTensorFields);
+    ReadFields(mesh, objects, volSymmTensorFields);
 
     PtrList<volTensorField> volTensorFields;
-    readFields(mesh, objects, volTensorFields);
+    ReadFields(mesh, objects, volTensorFields);
 
     //- uncomment if you want to interpolate surface fields (usually bad idea)
     //Info<< "Reading all current surfaceFields" << endl;
     //PtrList<surfaceScalarField> surfaceScalarFields;
-    //readFields(mesh, objects, surfaceScalarFields);
+    //ReadFields(mesh, objects, surfaceScalarFields);
     //
     //PtrList<surfaceVectorField> surfaceVectorFields;
-    //readFields(mesh, objects, surfaceVectorFields);
+    //ReadFields(mesh, objects, surfaceVectorFields);
     //
     //PtrList<surfaceTensorField> surfaceTensorFields;
-    //readFields(mesh, objects, surfaceTensorFields);
+    //ReadFields(mesh, objects, surfaceTensorFields);
 
     if (!overwrite)
     {
@@ -390,10 +365,24 @@ int main(int argc, char *argv[])
     mesh.movePoints(morphMap->preMotionPoints());
 
     // Write mesh
+    if (overwrite)
+    {
+        mesh.setInstance(oldInstance);
+    }
     Info << nl << "Writing polyMesh to time " << runTime.timeName() << endl;
 
     IOstream::defaultPrecision(10);
-    if (!mesh.write())
+
+    // Bypass runTime write (since only writes at outputTime)
+    if
+    (
+       !runTime.objectRegistry::writeObject
+        (
+            runTime.writeFormat(),
+            IOstream::currentVersion,
+            runTime.writeCompression()
+        )
+    )
     {
         FatalErrorIn(args.executable())
             << "Failed writing polyMesh."
index cce2f1c..c4bee71 100644 (file)
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -35,9 +35,11 @@ License
 #include "plane.H"
 #include "polyTopoChanger.H"
 #include "polyAddPoint.H"
+#include "polyRemovePoint.H"
 #include "polyAddFace.H"
 #include "polyModifyPoint.H"
 #include "polyModifyFace.H"
+#include "polyRemoveFace.H"
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
@@ -372,7 +374,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
     // sliding intergace coupling in order to allow the point
     // projection to be done separately from the actual cutting.
     // Please change consistently with slidingInterfaceProjectPoints.C
-    // 
+    //
     if (debug)
     {
         Pout << "Processing slave edges " << endl;
@@ -543,7 +545,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
             forAll (curFaces, faceI)
             {
 //                 Pout<< "face: " << curFaces[faceI] << " "
-//                     << masterPatch[curFaces[faceI]] 
+//                     << masterPatch[curFaces[faceI]]
 //                     << " local: "
 //                     << masterPatch.localFaces()[curFaces[faceI]]
 //                     << endl;
@@ -566,7 +568,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
             // The edge cutting code is repeated in
             // slidingInterface::modifyMotionPoints.  This is done for
             // efficiency reasons and avoids multiple creation of cutting
-            // planes.  Please update both simultaneously.  
+            // planes.  Please update both simultaneously.
 
             const point& a = projectedSlavePoints[curEdge.start()];
             const point& b = projectedSlavePoints[curEdge.end()];
@@ -623,7 +625,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
                         if (slaveCut.hit())
                         {
                             // Strict checking of slave cut to avoid capturing
-                            // end points.  
+                            // end points.
                             scalar cutOnSlave =
                                 (
                                     (
@@ -739,9 +741,6 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
         } // End if both ends missing
     } // End for all slave edges
 
-//     Pout << "pointsIntoMasterEdges: " << pointsIntoMasterEdges << endl;
-//     Pout << "pointsIntoSlaveEdges: " << pointsIntoSlaveEdges << endl;
-
     // Re-pack the points into edges lists
     labelListList pime(pointsIntoMasterEdges.size());
 
@@ -765,6 +764,9 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
         projectedSlavePoints
     );
 
+    // Demand driven calculate the cut faces. Apart from the
+    // cutFaces/cutFaceMaster/cutFaceSlave no information from the cutPatch
+    // is used anymore!
     const faceList& cutFaces = cutPatch.cutFaces();
     const labelList& cutFaceMaster = cutPatch.cutFaceMaster();
     const labelList& cutFaceSlave = cutPatch.cutFaceSlave();
@@ -1109,22 +1111,26 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
         {
             nOrphanedMasters++;
 
-            // Recover original orientation
-            ref.setAction
-            (
-                polyModifyFace
-                (
-                    masterPatch[faceI],                 // new face
-                    masterPatchAddr[faceI],             // master face index
-                    -1,                                 // owner
-                    -1,                                 // neighbour
-                    false,                              // flux flip
-                    -1,                                 // patch ID
-                    false,                              // remove from zone
-                    masterFaceZoneID_.index(),          // zone ID
-                    false                               // zone flip
-                )
-            );
+            //// Recover original orientation
+            //ref.setAction
+            //(
+            //    polyModifyFace
+            //    (
+            //        masterPatch[faceI],                 // new face
+            //        masterPatchAddr[faceI],             // master face index
+            //        -1,                                 // owner
+            //        -1,                                 // neighbour
+            //        false,                              // flux flip
+            //        -1,                                 // patch ID
+            //        false,                              // remove from zone
+            //        masterFaceZoneID_.index(),          // zone ID
+            //        false                               // zone flip
+            //    )
+            //);
+
+            //Pout<< "**MJ:deleting master face " << masterPatchAddr[faceI]
+            //    << " old verts:" << masterPatch[faceI] << endl;
+            ref.setAction(polyRemoveFace(masterPatchAddr[faceI]));
         }
     }
 
@@ -1136,22 +1142,26 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
         {
             nOrphanedSlaves++;
 
-            // Recover original orientation
-            ref.setAction
-            (
-                polyModifyFace
-                (
-                    slavePatch[faceI],                // new face
-                    slavePatchAddr[faceI],            // slave face index
-                    -1,                               // owner
-                    -1,                               // neighbour
-                    false,                            // flux flip
-                    -1,                               // patch ID
-                    false,                            // remove from zone
-                    slaveFaceZoneID_.index(),         // zone ID
-                    false                             // zone flip
-                )
-            );
+            //// Recover original orientation
+            //ref.setAction
+            //(
+            //    polyModifyFace
+            //    (
+            //        slavePatch[faceI],                // new face
+            //        slavePatchAddr[faceI],            // slave face index
+            //        -1,                               // owner
+            //        -1,                               // neighbour
+            //        false,                            // flux flip
+            //        -1,                               // patch ID
+            //        false,                            // remove from zone
+            //        slaveFaceZoneID_.index(),         // zone ID
+            //        false                             // zone flip
+            //    )
+            //);
+
+            //Pout<< "**MJ:deleting slave face " << slavePatchAddr[faceI]
+            //    << " old verts:" << slavePatch[faceI] << endl;
+            ref.setAction(polyRemoveFace(slavePatchAddr[faceI]));
         }
     }
 
@@ -1403,21 +1413,42 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
 //             Pout << "Modifying master stick-out face " << curFaceID << " old face: " << oldFace << " new face: " << newFace << endl;
 
             // Modify the face
-            ref.setAction
-            (
-                polyModifyFace
+            if (mesh.isInternalFace(curFaceID))
+            {
+                ref.setAction
                 (
-                    newFace,                // modified face
-                    curFaceID,              // label of face being modified
-                    own[curFaceID],         // owner
-                    nei[curFaceID],         // neighbour
-                    false,                  // face flip
-                    mesh.boundaryMesh().whichPatch(curFaceID), // patch for face
-                    false,                  // remove from zone
-                    modifiedFaceZone,       // zone for face
-                    modifiedFaceZoneFlip    // face flip in zone
-                )
-            );
+                    polyModifyFace
+                    (
+                        newFace,                // modified face
+                        curFaceID,              // label of face being modified
+                        own[curFaceID],         // owner
+                        nei[curFaceID],         // neighbour
+                        false,                  // face flip
+                        -1,                     // patch for face
+                        false,                  // remove from zone
+                        modifiedFaceZone,       // zone for face
+                        modifiedFaceZoneFlip    // face flip in zone
+                    )
+                );
+            }
+            else
+            {
+                ref.setAction
+                (
+                    polyModifyFace
+                    (
+                        newFace,                // modified face
+                        curFaceID,              // label of face being modified
+                        own[curFaceID],         // owner
+                        -1,                     // neighbour
+                        false,                  // face flip
+                        mesh.boundaryMesh().whichPatch(curFaceID), // patch for face
+                        false,                  // remove from zone
+                        modifiedFaceZone,       // zone for face
+                        modifiedFaceZoneFlip    // face flip in zone
+                    )
+                );
+            }
         }
     }
 
@@ -1688,21 +1719,42 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
 //             Pout << "Modifying slave stick-out face " << curFaceID << " old face: " << oldFace << " new face: " << newFace << endl;
 
             // Modify the face
-            ref.setAction
-            (
-                polyModifyFace
+            if (mesh.isInternalFace(curFaceID))
+            {
+                ref.setAction
                 (
-                    newFace,                // modified face
-                    curFaceID,              // label of face being modified
-                    own[curFaceID],         // owner
-                    nei[curFaceID],         // neighbour
-                    false,                  // face flip
-                    mesh.boundaryMesh().whichPatch(curFaceID), // patch for face
-                    false,                  // remove from zone
-                    modifiedFaceZone,       // zone for face
-                    modifiedFaceZoneFlip    // face flip in zone
-                )
-            );
+                    polyModifyFace
+                    (
+                        newFace,                // modified face
+                        curFaceID,              // label of face being modified
+                        own[curFaceID],         // owner
+                        nei[curFaceID],         // neighbour
+                        false,                  // face flip
+                        -1,                     // patch for face
+                        false,                  // remove from zone
+                        modifiedFaceZone,       // zone for face
+                        modifiedFaceZoneFlip    // face flip in zone
+                    )
+                );
+            }
+            else
+            {
+                ref.setAction
+                (
+                    polyModifyFace
+                    (
+                        newFace,                // modified face
+                        curFaceID,              // label of face being modified
+                        own[curFaceID],         // owner
+                        -1,                     // neighbour
+                        false,                  // face flip
+                        mesh.boundaryMesh().whichPatch(curFaceID), // patch for face
+                        false,                  // remove from zone
+                        modifiedFaceZone,       // zone for face
+                        modifiedFaceZoneFlip    // face flip in zone
+                    )
+                );
+            }
         }
     }
 
@@ -1735,15 +1787,25 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
             // slave patch
             nRetiredPoints++;
 
+            //ref.setAction
+            //(
+            //    polyModifyPoint
+            //    (
+            //        slaveMeshPoints[pointI],             // point ID
+            //        points[slaveMeshPoints[pointI]],     // point
+            //        false,                               // remove from zone
+            //        mesh.pointZones().whichZone(slaveMeshPoints[pointI]),// zone
+            //        false                                // in a cell
+            //    )
+            //);
+            //Pout<< "MJ retire slave point " << slaveMeshPoints[pointI]
+            //    << " coord " << points[slaveMeshPoints[pointI]]
+            //    << endl;
             ref.setAction
             (
-                polyModifyPoint
+                polyRemovePoint
                 (
-                    slaveMeshPoints[pointI],             // point ID
-                    points[slaveMeshPoints[pointI]],     // point
-                    false,                               // remove from zone
-                    mesh.pointZones().whichZone(slaveMeshPoints[pointI]),// zone
-                    false                                // in a cell
+                    slaveMeshPoints[pointI]
                 )
             );
 
index ce08c9a..7269a7b 100644 (file)
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
index 2fbc02d..191dc8d 100644 (file)
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -664,14 +664,17 @@ void Foam::slidingInterface::updateMesh(const mapPolyMesh& m)
     masterPatchID_.update(mesh.boundaryMesh());
     slavePatchID_.update(mesh.boundaryMesh());
 
-    if (!attached())
-    {
-        calcAttachedAddressing();
-    }
-    else
-    {
-        renumberAttachedAddressing(m);
-    }
+
+//Pout<< "**Mj: disabled updating." << endl;
+
+//    if (!attached())
+//    {
+//        calcAttachedAddressing();
+//    }
+//    else
+//    {
+//        renumberAttachedAddressing(m);
+//    }
 }
 
 
index e017016..376c969 100644 (file)
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
index 522b576..49af1fa 100644 (file)
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
index eaa8f1b..f530f61 100644 (file)
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
index 821eb33..a34fd0f 100644 (file)
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
index e51b8df..838500f 100644 (file)
@@ -5,6 +5,8 @@ linearValveFvMesh/linearValveFvMesh.C
 linearValveLayersFvMesh/linearValveLayersFvMesh.C
 */
 movingConeTopoFvMesh/movingConeTopoFvMesh.C
+/*
 mixerFvMesh/mixerFvMesh.C
+*/
 
 LIB = $(FOAM_LIBBIN)/libtopoChangerFvMesh