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
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #ifndef polyMeshAdder_H
00039 #define polyMeshAdder_H
00040
00041 #include <OpenFOAM/autoPtr.H>
00042 #include <OpenFOAM/polyMesh.H>
00043 #include <OpenFOAM/mapAddedPolyMesh.H>
00044 #include "faceCoupleInfo.H"
00045 #include <OpenFOAM/SortableList.H>
00046
00047
00048
00049 namespace Foam
00050 {
00051
00052
00053 class IOobject;
00054 class polyTopoChange;
00055
00056
00057
00058
00059
00060 class polyMeshAdder
00061 {
00062
00063 private:
00064
00065
00066
00067
00068
00069
00070 template<class T>
00071 static void append(const List<T>&, DynamicList<T>&);
00072
00073
00074 static void append
00075 (
00076 const labelList& map,
00077 const labelList& lst,
00078 DynamicList<label>&
00079 );
00080
00081
00082
00083 static void append
00084 (
00085 const labelList& map,
00086 const labelList& lst,
00087 const SortableList<label>& sortedLst,
00088 DynamicList<label>&
00089 );
00090
00091
00092 static label patchIndex
00093 (
00094 const polyPatch&,
00095 DynamicList<word>& allPatchNames,
00096 DynamicList<word>& allPatchTypes
00097 );
00098
00099
00100 static label zoneIndex(const word&, DynamicList<word>&);
00101
00102 static void mergePatchNames
00103 (
00104 const polyBoundaryMesh& patches0,
00105 const polyBoundaryMesh& patches1,
00106
00107 DynamicList<word>& allPatchNames,
00108 DynamicList<word>& allPatchTypes,
00109
00110 labelList& from1ToAllPatches,
00111 labelList& fromAllTo1Patches
00112 );
00113
00114
00115 static labelList getPatchStarts(const polyBoundaryMesh&);
00116
00117 static labelList getPatchSizes(const polyBoundaryMesh&);
00118
00119 static List<polyPatch*> combinePatches
00120 (
00121 const polyMesh& mesh0,
00122 const polyMesh& mesh1,
00123 const polyBoundaryMesh& allBoundaryMesh,
00124 const label nAllPatches,
00125 const labelList& fromAllTo1Patches,
00126
00127 const label nInternalFaces,
00128 const labelList& nFaces,
00129
00130 labelList& from0ToAllPatches,
00131 labelList& from1ToAllPatches
00132 );
00133
00134
00135
00136 static labelList getFaceOrder
00137 (
00138 const cellList& cells,
00139 const label nInternalFaces,
00140 const labelList& owner,
00141 const labelList& neighbour
00142 );
00143
00144
00145
00146 static void insertVertices
00147 (
00148 const edgeLookup& cutEdgeToPoints,
00149 const Map<label>& meshToMaster,
00150 const labelList& masterToCutPoints,
00151 const face& masterFace,
00152
00153 DynamicList<label>& workFace,
00154 face& f
00155 );
00156
00157
00158 static void mergePrimitives
00159 (
00160 const polyMesh& mesh0,
00161 const polyMesh& mesh1,
00162 const faceCoupleInfo& coupleInfo,
00163
00164 const label nAllPatches,
00165 const labelList& fromAllTo1Patches,
00166 const labelList& from1ToAllPatches,
00167
00168 pointField& allPoints,
00169 labelList& from0ToAllPoints,
00170 labelList& from1ToAllPoints,
00171
00172 faceList& allFaces,
00173 labelList& allOwner,
00174 labelList& allNeighbour,
00175 label& nInternalFaces,
00176 labelList& nFacesPerPatch,
00177 label& nCells,
00178
00179 labelList& from0ToAllFaces,
00180 labelList& from1ToAllFaces,
00181 labelList& from1ToAllCells
00182 );
00183
00184
00185 static void mergePointZones
00186 (
00187 const pointZoneMesh& pz0,
00188 const pointZoneMesh& pz1,
00189 const labelList& from0ToAllPoints,
00190 const labelList& from1ToAllPoints,
00191
00192 DynamicList<word>& zoneNames,
00193 labelList& from1ToAll,
00194 List<DynamicList<label> >& pzPoints
00195 );
00196
00197
00198 static void mergeFaceZones
00199 (
00200 const faceZoneMesh& fz0,
00201 const faceZoneMesh& fz1,
00202 const labelList& from0ToAllFaces,
00203 const labelList& from1ToAllFaces,
00204
00205 DynamicList<word>& zoneNames,
00206 labelList& from1ToAll,
00207 List<DynamicList<label> >& fzFaces,
00208 List<DynamicList<bool> >& fzFlips
00209 );
00210
00211
00212 static void mergeCellZones
00213 (
00214 const cellZoneMesh& cz0,
00215 const cellZoneMesh& cz1,
00216 const labelList& from1ToAllCells,
00217
00218 DynamicList<word>& zoneNames,
00219 labelList& from1ToAll,
00220 List<DynamicList<label> >& czCells
00221 );
00222
00223
00224 static void mergeZones
00225 (
00226 const polyMesh& mesh0,
00227 const polyMesh& mesh1,
00228 const labelList& from0ToAllPoints,
00229 const labelList& from0ToAllFaces,
00230 const labelList& from1ToAllPoints,
00231 const labelList& from1ToAllFaces,
00232 const labelList& from1ToAllCells,
00233
00234 DynamicList<word>& pointZoneNames,
00235 List<DynamicList<label> >& pzPoints,
00236
00237 DynamicList<word>& faceZoneNames,
00238 List<DynamicList<label> >& fzFaces,
00239 List<DynamicList<bool> >& fzFlips,
00240
00241 DynamicList<word>& cellZoneNames,
00242 List<DynamicList<label> >& czCells
00243 );
00244
00245
00246 static void addZones
00247 (
00248 const DynamicList<word>& pointZoneNames,
00249 const List<DynamicList<label> >& pzPoints,
00250
00251 const DynamicList<word>& faceZoneNames,
00252 const List<DynamicList<label> >& fzFaces,
00253 const List<DynamicList<bool> >& fzFlips,
00254
00255 const DynamicList<word>& cellZoneNames,
00256 const List<DynamicList<label> >& czCells,
00257
00258 polyMesh& mesh
00259 );
00260
00261 public:
00262
00263
00264
00265
00266
00267
00268 static autoPtr<polyMesh> add
00269 (
00270 const IOobject& io,
00271 const polyMesh& mesh0,
00272 const polyMesh& mesh1,
00273 const faceCoupleInfo& coupleInfo,
00274 autoPtr<mapAddedPolyMesh>& mapPtr
00275 );
00276
00277
00278 static autoPtr<mapAddedPolyMesh> add
00279 (
00280 polyMesh& mesh0,
00281 const polyMesh& mesh1,
00282 const faceCoupleInfo& coupleInfo,
00283 const bool validBoundary = true
00284 );
00285
00286
00287
00288
00289
00290
00291
00292
00293 static Map<label> findSharedPoints
00294 (
00295 const polyMesh&,
00296 const scalar mergeTol
00297 );
00298
00299
00300
00301
00302
00303 static void mergePoints
00304 (
00305 const polyMesh&,
00306 const Map<label>& pointToMaster,
00307 polyTopoChange& meshMod
00308 );
00309 };
00310
00311
00312
00313
00314 }
00315
00316
00317
00318 #ifdef NoRepository
00319 # include <dynamicMesh/polyMeshAdderTemplates.C>
00320 #endif
00321
00322
00323
00324 #endif
00325
00326