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