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 "starMesh.H"
00030 #include <OpenFOAM/IFstream.H>
00031
00032
00033
00034 void starMesh::readCouples()
00035 {
00036 fileName couplesFileName(casePrefix_ + ".cpl");
00037
00038 label nCouples = 0;
00039
00040
00041 {
00042 IFstream couplesFile(couplesFileName);
00043
00044 if (couplesFile.good())
00045 {
00046 Info << "\nReading couples" << endl;
00047
00048 label matchLabel, nEntries, typeFlag;
00049 label starMasterCell, rotXMasterFace;
00050 label starSlaveCell, rotXSlaveFace;
00051
00052
00053 while (!(couplesFile >> matchLabel).eof())
00054 {
00055
00056 couplesFile >> nEntries;
00057
00058 couplesFile >> typeFlag;
00059
00060
00061 couplesFile >> starMasterCell >> rotXMasterFace;
00062
00063
00064 label nSlavesToRead = nEntries - 1;
00065
00066 nCouples += nSlavesToRead;
00067
00068 for (int i = 0; i < nSlavesToRead; i++)
00069 {
00070 couplesFile >> starSlaveCell >> rotXSlaveFace;
00071 }
00072 }
00073
00074 Info<< "Number of couples = " << nCouples << endl << endl;
00075 }
00076 else
00077 {
00078 Info<< endl << "No couple matches defined." << endl;
00079 }
00080 }
00081
00082
00083 if (nCouples > 0)
00084 {
00085
00086 couples_.setSize(nCouples);
00087 label couplei = 0;
00088
00089
00090 isShapeMesh_ = false;
00091
00092 IFstream couplesFile(couplesFileName);
00093
00094 label matchLabel, nEntries, typeFlag;
00095 label starMasterCell, masterCell, rotXMasterFace, rotZeroMasterFace;
00096 label starSlaveCell, slaveCell, rotXSlaveFace, rotZeroSlaveFace;
00097
00098 while (!(couplesFile >> matchLabel).eof())
00099 {
00100
00101
00102 couplesFile >> nEntries;
00103
00104 couplesFile >> typeFlag;
00105
00106
00107 couplesFile >> starMasterCell >> rotXMasterFace;
00108
00109
00110 masterCell = starCellLabelLookup_[starMasterCell];
00111
00112
00113 if (starCellPermutation_[masterCell] > -1)
00114 {
00115 const label curMasterPermutation =
00116 starCellPermutation_[masterCell];
00117
00118 rotZeroMasterFace =
00119 sammFacePermutationTable
00120 [curMasterPermutation]
00121 [rotXMasterFace];
00122 }
00123 else
00124 {
00125 rotZeroMasterFace = rotXMasterFace;
00126 }
00127
00128
00129 label masterFaceID =
00130 shapeFaceLookup
00131 [cellShapes_[masterCell].model().index()]
00132 [rotZeroMasterFace];
00133
00134
00135 label nSlavesToRead = nEntries - 1;
00136
00137 for (int i = 0; i < nSlavesToRead; i++)
00138 {
00139 couplesFile >> starSlaveCell >> rotXSlaveFace;
00140
00141
00142 slaveCell = starCellLabelLookup_[starSlaveCell];
00143
00144
00145 if (starCellPermutation_[slaveCell] > -1)
00146 {
00147 const label curSlavePermutation =
00148 starCellPermutation_[slaveCell];
00149
00150 rotZeroSlaveFace =
00151 sammFacePermutationTable
00152 [curSlavePermutation]
00153 [rotXSlaveFace];
00154 }
00155 else
00156 {
00157 rotZeroSlaveFace = rotXSlaveFace;
00158 }
00159
00160 label slaveFaceID =
00161 shapeFaceLookup
00162 [cellShapes_[slaveCell].model().index()]
00163 [rotZeroSlaveFace];
00164
00165
00166 couples_.set
00167 (
00168 couplei++,
00169 new coupledFacePair
00170 (
00171 matchLabel,
00172 masterCell, masterFaceID,
00173 slaveCell, slaveFaceID,
00174 typeFlag
00175 )
00176 );
00177 }
00178 }
00179
00180 Info << "finished reading couples" << endl;
00181 }
00182 }
00183
00184
00185