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 #include "mapDistributePolyMesh.H"
00027 #include <OpenFOAM/polyMesh.H>
00028
00029
00030
00031
00032 void Foam::mapDistributePolyMesh::calcPatchSizes()
00033 {
00034 oldPatchSizes_.setSize(oldPatchStarts_.size());
00035
00036
00037 for (label patchI = 0; patchI < oldPatchStarts_.size() - 1; patchI++)
00038 {
00039 oldPatchSizes_[patchI] =
00040 oldPatchStarts_[patchI + 1] - oldPatchStarts_[patchI];
00041 }
00042
00043
00044 const label lastPatchID = oldPatchStarts_.size() - 1;
00045
00046 oldPatchSizes_[lastPatchID] = nOldFaces_ - oldPatchStarts_[lastPatchID];
00047
00048 if (min(oldPatchSizes_) < 0)
00049 {
00050 FatalErrorIn("mapDistributePolyMesh::calcPatchSizes()")
00051 << "Calculated negative old patch size:" << oldPatchSizes_ << nl
00052 << "Error in mapping data" << abort(FatalError);
00053 }
00054 }
00055
00056
00057
00058
00059
00060 Foam::mapDistributePolyMesh::mapDistributePolyMesh
00061 (
00062 const polyMesh& mesh,
00063
00064
00065 const label nOldPoints,
00066 const label nOldFaces,
00067 const label nOldCells,
00068 const labelList& oldPatchStarts,
00069 const labelList& oldPatchNMeshPoints,
00070
00071
00072 const labelListList& subPointMap,
00073 const labelListList& subFaceMap,
00074 const labelListList& subCellMap,
00075 const labelListList& subPatchMap,
00076
00077
00078 const labelListList& constructPointMap,
00079 const labelListList& constructFaceMap,
00080 const labelListList& constructCellMap,
00081 const labelListList& constructPatchMap
00082 )
00083 :
00084 mesh_(mesh),
00085 nOldPoints_(nOldPoints),
00086 nOldFaces_(nOldFaces),
00087 nOldCells_(nOldCells),
00088 oldPatchSizes_(oldPatchStarts.size()),
00089 oldPatchStarts_(oldPatchStarts),
00090 oldPatchNMeshPoints_(oldPatchNMeshPoints),
00091 pointMap_(mesh.nPoints(), subPointMap, constructPointMap),
00092 faceMap_(mesh.nFaces(), subFaceMap, constructFaceMap),
00093 cellMap_(mesh.nCells(), subCellMap, constructCellMap),
00094 patchMap_(mesh.boundaryMesh().size(), subPatchMap, constructPatchMap)
00095 {
00096 calcPatchSizes();
00097 }
00098
00099
00100
00101 Foam::mapDistributePolyMesh::mapDistributePolyMesh
00102 (
00103 const polyMesh& mesh,
00104 const label nOldPoints,
00105 const label nOldFaces,
00106 const label nOldCells,
00107 labelList& oldPatchStarts,
00108 labelList& oldPatchNMeshPoints,
00109
00110 labelListList& subPointMap,
00111 labelListList& subFaceMap,
00112 labelListList& subCellMap,
00113 labelListList& subPatchMap,
00114 labelListList& constructPointMap,
00115 labelListList& constructFaceMap,
00116 labelListList& constructCellMap,
00117 labelListList& constructPatchMap,
00118 const bool reUse
00119 )
00120 :
00121 mesh_(mesh),
00122 nOldPoints_(nOldPoints),
00123 nOldFaces_(nOldFaces),
00124 nOldCells_(nOldCells),
00125 oldPatchSizes_(oldPatchStarts.size()),
00126 oldPatchStarts_(oldPatchStarts, reUse),
00127 oldPatchNMeshPoints_(oldPatchNMeshPoints, reUse),
00128
00129 pointMap_(mesh.nPoints(), subPointMap, constructPointMap, reUse),
00130 faceMap_(mesh.nFaces(), subFaceMap, constructFaceMap, reUse),
00131 cellMap_(mesh.nCells(), subCellMap, constructCellMap, reUse),
00132 patchMap_(mesh.boundaryMesh().size(), subPatchMap, constructPatchMap, reUse)
00133 {
00134 calcPatchSizes();
00135 }
00136
00137
00138
00139
00140 void Foam::mapDistributePolyMesh::distributePointIndices(labelList& lst) const
00141 {
00142
00143 boolList isSelected
00144 (
00145 createWithValues<boolList>
00146 (
00147 nOldPoints(),
00148 false,
00149 lst,
00150 true
00151 )
00152 );
00153
00154
00155 distributePointData(isSelected);
00156
00157
00158 lst = findIndices(isSelected, true);
00159 }
00160
00161
00162 void Foam::mapDistributePolyMesh::distributeFaceIndices(labelList& lst) const
00163 {
00164
00165 boolList isSelected
00166 (
00167 createWithValues<boolList>
00168 (
00169 nOldFaces(),
00170 false,
00171 lst,
00172 true
00173 )
00174 );
00175
00176
00177 distributeFaceData(isSelected);
00178
00179
00180 lst = findIndices(isSelected, true);
00181 }
00182
00183
00184 void Foam::mapDistributePolyMesh::distributeCellIndices(labelList& lst) const
00185 {
00186
00187 boolList isSelected
00188 (
00189 createWithValues<boolList>
00190 (
00191 nOldCells(),
00192 false,
00193 lst,
00194 true
00195 )
00196 );
00197
00198
00199 distributeCellData(isSelected);
00200
00201
00202 lst = findIndices(isSelected, true);
00203 }
00204
00205
00206 void Foam::mapDistributePolyMesh::distributePatchIndices(labelList& lst) const
00207 {
00208
00209 boolList isSelected
00210 (
00211 createWithValues<boolList>
00212 (
00213 oldPatchStarts().size(),
00214 false,
00215 lst,
00216 true
00217 )
00218 );
00219
00220
00221 distributePatchData(isSelected);
00222
00223
00224 lst = findIndices(isSelected, true);
00225 }
00226
00227
00228
00229
00230
00231
00232
00233
00234