attachPolyTopoChanger.C
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "attachPolyTopoChanger.H"
00028 #include "polyMesh.H"
00029 #include "polyTopoChange.H"
00030
00031
00032
00033 Foam::attachPolyTopoChanger::attachPolyTopoChanger
00034 (
00035 const IOobject& io,
00036 polyMesh& mesh
00037 )
00038 :
00039 polyTopoChanger(io, mesh)
00040 {}
00041
00042
00043 Foam::attachPolyTopoChanger::attachPolyTopoChanger
00044 (
00045 polyMesh& mesh
00046 )
00047 :
00048 polyTopoChanger(mesh)
00049 {}
00050
00051
00052
00053
00054
00055 void Foam::attachPolyTopoChanger::attach(const bool removeEmptyPatches)
00056 {
00057 if (debug)
00058 {
00059 Pout<< "void attachPolyTopoChanger::attach(): "
00060 << "Attaching mesh" << endl;
00061 }
00062
00063
00064 const fileName oldInst = mesh_.facesInstance();
00065
00066
00067 changeMesh(false);
00068
00069 const pointField p = mesh_.oldPoints();
00070
00071 mesh_.movePoints(p);
00072
00073 if (debug)
00074 {
00075 Pout << "Clearing mesh." << endl;
00076 }
00077
00078 if (removeEmptyPatches)
00079 {
00080
00081 const polyBoundaryMesh& oldPatches = mesh_.boundaryMesh();
00082
00083 List<polyPatch*> newPatches(oldPatches.size());
00084 label nNewPatches = 0;
00085
00086 forAll (oldPatches, patchI)
00087 {
00088 if (oldPatches[patchI].size())
00089 {
00090 newPatches[nNewPatches] = oldPatches[patchI].clone
00091 (
00092 mesh_.boundaryMesh(),
00093 nNewPatches,
00094 oldPatches[patchI].size(),
00095 oldPatches[patchI].start()
00096 ).ptr();
00097
00098 nNewPatches++;
00099 }
00100 else
00101 {
00102 if (debug)
00103 {
00104 Pout<< "Removing zero-sized patch " << patchI
00105 << " named " << oldPatches[patchI].name() << endl;
00106 }
00107 }
00108 }
00109
00110 newPatches.setSize(nNewPatches);
00111
00112 mesh_.removeBoundary();
00113 mesh_.addPatches(newPatches);
00114 }
00115
00116
00117 mesh_.setInstance(oldInst);
00118
00119 if (debug)
00120 {
00121 Pout<< "void attachPolyTopoChanger::attach(): "
00122 << "Finished attaching mesh" << endl;
00123 }
00124
00125 mesh_.checkMesh();
00126 }
00127
00128
00129
Copyright © 2000-2009 OpenCFD Ltd