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 "meshToMesh.H"
00027 #include <finiteVolume/processorFvPatch.H>
00028 #include <OpenFOAM/demandDrivenData.H>
00029
00030
00031
00032 namespace Foam
00033 {
00034
00035
00036
00037 defineTypeNameAndDebug(meshToMesh, 0);
00038
00039 const scalar meshToMesh::directHitTol = 1e-5;
00040
00041
00042
00043 meshToMesh::meshToMesh
00044 (
00045 const fvMesh& meshFrom,
00046 const fvMesh& meshTo,
00047 const HashTable<word>& patchMap,
00048 const wordList& cuttingPatchNames
00049 )
00050 :
00051 fromMesh_(meshFrom),
00052 toMesh_(meshTo),
00053 patchMap_(patchMap),
00054 cellAddressing_(toMesh_.nCells()),
00055 boundaryAddressing_(toMesh_.boundaryMesh().size()),
00056 inverseDistanceWeightsPtr_(NULL)
00057 {
00058 forAll (fromMesh_.boundaryMesh(), patchi)
00059 {
00060 fromMeshPatches_.insert
00061 (
00062 fromMesh_.boundaryMesh()[patchi].name(),
00063 patchi
00064 );
00065 }
00066
00067 forAll (toMesh_.boundaryMesh(), patchi)
00068 {
00069 toMeshPatches_.insert
00070 (
00071 toMesh_.boundaryMesh()[patchi].name(),
00072 patchi
00073 );
00074 }
00075
00076 forAll (cuttingPatchNames, i)
00077 {
00078 if (toMeshPatches_.found(cuttingPatchNames[i]))
00079 {
00080 cuttingPatches_.insert
00081 (
00082 cuttingPatchNames[i],
00083 toMeshPatches_.find(cuttingPatchNames[i])()
00084 );
00085 }
00086 else
00087 {
00088 WarningIn
00089 (
00090 "meshToMesh::meshToMesh"
00091 "(const fvMesh& meshFrom, const fvMesh& meshTo,"
00092 "const HashTable<word>& patchMap,"
00093 "const wordList& cuttingPatchNames)"
00094 ) << "Cannot find cutting-patch " << cuttingPatchNames[i]
00095 << " in destination mesh" << endl;
00096 }
00097 }
00098
00099 forAll (toMesh_.boundaryMesh(), patchi)
00100 {
00101
00102 if (isA<processorPolyPatch>(toMesh_.boundaryMesh()[patchi]))
00103 {
00104 cuttingPatches_.insert
00105 (
00106 toMesh_.boundaryMesh()[patchi].name(),
00107 patchi
00108 );
00109 }
00110 }
00111
00112 calcAddressing();
00113 }
00114
00115
00116 meshToMesh::meshToMesh
00117 (
00118 const fvMesh& meshFrom,
00119 const fvMesh& meshTo
00120 )
00121 :
00122 fromMesh_(meshFrom),
00123 toMesh_(meshTo),
00124 cellAddressing_(toMesh_.nCells()),
00125 boundaryAddressing_(toMesh_.boundaryMesh().size()),
00126 inverseDistanceWeightsPtr_(NULL)
00127 {
00128
00129
00130 if (fromMesh_.boundary().size() != toMesh_.boundary().size())
00131 {
00132 FatalErrorIn
00133 (
00134 "meshToMesh::meshToMesh"
00135 "(const fvMesh& meshFrom, const fvMesh& meshTo)"
00136 ) << "Incompatible meshes: different number of patches, "
00137 << "fromMesh = " << fromMesh_.boundary().size()
00138 << ", toMesh = " << toMesh_.boundary().size()
00139 << exit(FatalError);
00140 }
00141
00142 forAll (fromMesh_.boundaryMesh(), patchi)
00143 {
00144 if
00145 (
00146 fromMesh_.boundaryMesh()[patchi].name()
00147 != toMesh_.boundaryMesh()[patchi].name()
00148 )
00149 {
00150 FatalErrorIn
00151 (
00152 "meshToMesh::meshToMesh"
00153 "(const fvMesh& meshFrom, const fvMesh& meshTo)"
00154 ) << "Incompatible meshes: different patch names for patch "
00155 << patchi
00156 << ", fromMesh = " << fromMesh_.boundary()[patchi].name()
00157 << ", toMesh = " << toMesh_.boundary()[patchi].name()
00158 << exit(FatalError);
00159 }
00160
00161 if
00162 (
00163 fromMesh_.boundaryMesh()[patchi].type()
00164 != toMesh_.boundaryMesh()[patchi].type()
00165 )
00166 {
00167 FatalErrorIn
00168 (
00169 "meshToMesh::meshToMesh"
00170 "(const fvMesh& meshFrom, const fvMesh& meshTo)"
00171 ) << "Incompatible meshes: different patch types for patch "
00172 << patchi
00173 << ", fromMesh = " << fromMesh_.boundary()[patchi].type()
00174 << ", toMesh = " << toMesh_.boundary()[patchi].type()
00175 << exit(FatalError);
00176 }
00177
00178 fromMeshPatches_.insert
00179 (
00180 fromMesh_.boundaryMesh()[patchi].name(),
00181 patchi
00182 );
00183
00184 toMeshPatches_.insert
00185 (
00186 toMesh_.boundaryMesh()[patchi].name(),
00187 patchi
00188 );
00189
00190 patchMap_.insert
00191 (
00192 toMesh_.boundaryMesh()[patchi].name(),
00193 fromMesh_.boundaryMesh()[patchi].name()
00194 );
00195 }
00196
00197 calcAddressing();
00198 }
00199
00200
00201
00202
00203 meshToMesh::~meshToMesh()
00204 {
00205 deleteDemandDrivenData(inverseDistanceWeightsPtr_);
00206 }
00207
00208
00209
00210
00211 }
00212
00213