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