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