readCouples.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
00028
00029
00030 #include "sammMesh.H"
00031 #include "IFstream.H"
00032
00033
00034
00035 void sammMesh::readCouples()
00036 {
00037 fileName couplesFileName(casePrefix_ + ".cpl");
00038
00039 IFstream couplesFile(couplesFileName);
00040
00041 if (couplesFile.good())
00042 {
00043 Info << "\nReading couples" << endl;
00044
00045
00046 isShapeMesh_ = false;
00047
00048 label matchLabel, nEntries, typeFlag;
00049 label masterCell, masterFace;
00050 label slaveCell, slaveFace;
00051
00052 while (!(couplesFile >> matchLabel).eof())
00053 {
00054
00055
00056 couplesFile >> nEntries;
00057
00058 couplesFile >> typeFlag;
00059
00060 if (typeFlag > 1)
00061 {
00062 Info
00063 << "void sammMesh::readCouples() : "
00064 << "couple " << matchLabel << " is not an integral match. "
00065 << "Currently not supported" << endl;
00066 }
00067
00068
00069 couplesFile >> masterCell >> masterFace;
00070
00071
00072 faceList& masterFaces = cellFaces_[masterCell - 1];
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088 masterFaces
00089 [
00090 shapeFaceLookup
00091 [cellShapes_[masterCell - 1].model().index()]
00092 [masterFace]
00093 ].setSize(0);
00094
00095
00096 label nSlavesToRead = nEntries - 1;
00097
00098
00099 label slaveToAdd = masterFaces.size();
00100
00101
00102 masterFaces.setSize(masterFaces.size() + nSlavesToRead);
00103
00104 for (int i = 0; i < nSlavesToRead; i++)
00105 {
00106 couplesFile >> slaveCell >> slaveFace;
00107
00108 masterFaces[slaveToAdd] =
00109 cellFaces_
00110 [
00111 slaveCell - 1
00112 ]
00113 [
00114 shapeFaceLookup
00115 [cellShapes_[slaveCell - 1].model().index()]
00116 [slaveFace]
00117 ].reverseFace();
00118
00119
00120
00121
00122
00123 slaveToAdd++;
00124
00125 }
00126
00127
00128 }
00129
00130
00131 forAll (cellFaces_, cellI)
00132 {
00133 faceList& curFaces = cellFaces_[cellI];
00134
00135 label zeroSizeFound = 0;
00136
00137 forAll (curFaces, faceI)
00138 {
00139 if (curFaces[faceI].empty())
00140 {
00141 zeroSizeFound++;
00142 }
00143 }
00144
00145 if (zeroSizeFound > 0)
00146 {
00147
00148 faceList oldFaces = curFaces;
00149
00150 curFaces.setSize(curFaces.size() - zeroSizeFound);
00151
00152 label nFaces = 0;
00153
00154 forAll (oldFaces, faceI)
00155 {
00156 if (oldFaces[faceI].size())
00157 {
00158 curFaces[nFaces] = oldFaces[faceI];
00159
00160 nFaces++;
00161 }
00162 }
00163 }
00164 }
00165 }
00166 else
00167 {
00168 Info
00169 << "void sammMesh::readCouples() : "
00170 << "Cannot read file "
00171 << couplesFileName
00172 << ". No matches defined."
00173 << endl;
00174 }
00175 }
00176
00177
00178
Copyright © 2000-2009 OpenCFD Ltd