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 #include "fvFieldDecomposer.H"
00027
00028
00029
00030 namespace Foam
00031 {
00032
00033
00034
00035 fvFieldDecomposer::patchFieldDecomposer::patchFieldDecomposer
00036 (
00037 const unallocLabelList& addressingSlice,
00038 const label addressingOffset
00039 )
00040 :
00041 directAddressing_(addressingSlice)
00042 {
00043 forAll (directAddressing_, i)
00044 {
00045
00046 directAddressing_[i] -= addressingOffset + 1;
00047 }
00048 }
00049
00050
00051 fvFieldDecomposer::processorVolPatchFieldDecomposer::
00052 processorVolPatchFieldDecomposer
00053 (
00054 const fvMesh& mesh,
00055 const unallocLabelList& addressingSlice
00056 )
00057 :
00058 directAddressing_(addressingSlice.size())
00059 {
00060 const labelList& own = mesh.faceOwner();
00061 const labelList& neighb = mesh.faceNeighbour();
00062
00063 forAll (directAddressing_, i)
00064 {
00065
00066 label ai = mag(addressingSlice[i]) - 1;
00067
00068 if (ai < neighb.size())
00069 {
00070
00071
00072
00073
00074
00075 if (addressingSlice[i] >= 0)
00076 {
00077
00078 directAddressing_[i] = neighb[ai];
00079 }
00080 else
00081 {
00082 directAddressing_[i] = own[ai];
00083 }
00084 }
00085 else
00086 {
00087
00088
00089
00090
00091
00092
00093 directAddressing_[i] = own[ai];
00094 }
00095 }
00096 }
00097
00098
00099 fvFieldDecomposer::processorSurfacePatchFieldDecomposer::
00100 processorSurfacePatchFieldDecomposer
00101 (
00102 const unallocLabelList& addressingSlice
00103 )
00104 :
00105 addressing_(addressingSlice.size()),
00106 weights_(addressingSlice.size())
00107 {
00108 forAll (addressing_, i)
00109 {
00110 addressing_[i].setSize(1);
00111 weights_[i].setSize(1);
00112
00113 addressing_[i][0] = mag(addressingSlice[i]) - 1;
00114 weights_[i][0] = sign(addressingSlice[i]);
00115 }
00116 }
00117
00118
00119 fvFieldDecomposer::fvFieldDecomposer
00120 (
00121 const fvMesh& completeMesh,
00122 const fvMesh& procMesh,
00123 const labelList& faceAddressing,
00124 const labelList& cellAddressing,
00125 const labelList& boundaryAddressing
00126 )
00127 :
00128 completeMesh_(completeMesh),
00129 procMesh_(procMesh),
00130 faceAddressing_(faceAddressing),
00131 cellAddressing_(cellAddressing),
00132 boundaryAddressing_(boundaryAddressing),
00133 patchFieldDecomposerPtrs_
00134 (
00135 procMesh_.boundary().size(),
00136 static_cast<patchFieldDecomposer*>(NULL)
00137 ),
00138 processorVolPatchFieldDecomposerPtrs_
00139 (
00140 procMesh_.boundary().size(),
00141 static_cast<processorVolPatchFieldDecomposer*>(NULL)
00142 ),
00143 processorSurfacePatchFieldDecomposerPtrs_
00144 (
00145 procMesh_.boundary().size(),
00146 static_cast<processorSurfacePatchFieldDecomposer*>(NULL)
00147 )
00148 {
00149 forAll (boundaryAddressing_, patchi)
00150 {
00151 if (boundaryAddressing_[patchi] >= 0)
00152 {
00153 patchFieldDecomposerPtrs_[patchi] = new patchFieldDecomposer
00154 (
00155 procMesh_.boundary()[patchi].patchSlice(faceAddressing_),
00156 completeMesh_.boundaryMesh()
00157 [
00158 boundaryAddressing_[patchi]
00159 ].start()
00160 );
00161 }
00162 else
00163 {
00164 processorVolPatchFieldDecomposerPtrs_[patchi] =
00165 new processorVolPatchFieldDecomposer
00166 (
00167 completeMesh_,
00168 procMesh_.boundary()[patchi].patchSlice(faceAddressing_)
00169 );
00170
00171 processorSurfacePatchFieldDecomposerPtrs_[patchi] =
00172 new processorSurfacePatchFieldDecomposer
00173 (
00174 static_cast<const unallocLabelList&>
00175 (
00176 procMesh_.boundary()[patchi].patchSlice
00177 (
00178 faceAddressing_
00179 )
00180 )
00181 );
00182 }
00183 }
00184 }
00185
00186
00187
00188
00189 fvFieldDecomposer::~fvFieldDecomposer()
00190 {
00191 forAll (patchFieldDecomposerPtrs_, patchi)
00192 {
00193 if (patchFieldDecomposerPtrs_[patchi])
00194 {
00195 delete patchFieldDecomposerPtrs_[patchi];
00196 }
00197 }
00198
00199 forAll (processorVolPatchFieldDecomposerPtrs_, patchi)
00200 {
00201 if (processorVolPatchFieldDecomposerPtrs_[patchi])
00202 {
00203 delete processorVolPatchFieldDecomposerPtrs_[patchi];
00204 }
00205 }
00206
00207 forAll (processorSurfacePatchFieldDecomposerPtrs_, patchi)
00208 {
00209 if (processorSurfacePatchFieldDecomposerPtrs_[patchi])
00210 {
00211 delete processorSurfacePatchFieldDecomposerPtrs_[patchi];
00212 }
00213 }
00214 }
00215
00216
00217
00218
00219 }
00220
00221