USERD_get_part_elements_by_type.H
Go to the documentation of this file.00001 int USERD_get_part_elements_by_type
00002 (
00003 int part_number,
00004 int element_type,
00005 int **conn_array
00006 )
00007 {
00008 # ifdef ENSIGHTDEBUG
00009 Info<< "Entering: USERD_get_part_elements_by_type" << nl
00010 << "part_number = " << part_number << nl
00011 << "element_type = " << element_type;
00012 if (element_type == Z_HEX08)
00013 {
00014 Info << " Z_HEX08";
00015 }
00016 else if (element_type == Z_PEN06)
00017 {
00018 Info << " Z_PEN06";
00019 }
00020 else if (element_type == Z_PYR05)
00021 {
00022 Info << " Z_PYR05";
00023 }
00024 else if (element_type == Z_TET04)
00025 {
00026 Info << " Z_TET04";
00027 }
00028 else if (element_type == Z_TRI03)
00029 {
00030 Info << " Z_TRI03";
00031 }
00032 else if (element_type == Z_QUA04)
00033 {
00034 Info << " Z_QUA04";
00035 }
00036 else if (element_type == Z_NFACED)
00037 {
00038 Info << " Z_NFACED";
00039 }
00040 else if (element_type == Z_NSIDED)
00041 {
00042 Info << " Z_NSIDED";
00043 }
00044 else
00045 {
00046 Info << " unknown";
00047 }
00048 Info << endl << flush;
00049 # endif
00050
00051 if (part_number == 1)
00052 {
00053 const cellShapeList& cellShapes = meshPtr->cellShapes();
00054
00055
00056
00057
00058 if (element_type == Z_HEX08)
00059 {
00060 const cellModel& hex = *(cellModeller::lookup("hex"));
00061
00062 label nHex08 = 0;
00063 forAll(cellShapes, celli)
00064 {
00065 const cellShape& cellShape = cellShapes[celli];
00066 const cellModel& cellModel = cellShape.model();
00067
00068 if (cellModel == hex)
00069 {
00070 forAll(cellShape, ip)
00071 {
00072 conn_array[nHex08][ip] = cellShape[ip] + 1;
00073 }
00074 nHex08++;
00075 }
00076 }
00077 }
00078
00079
00080
00081 else if (element_type == Z_PEN06)
00082 {
00083 const cellModel& prism = *(cellModeller::lookup("prism"));
00084
00085 label nPen06 = 0;
00086 forAll(cellShapes, celli)
00087 {
00088 const cellShape& cellShape = cellShapes[celli];
00089 const cellModel& cellModel = cellShape.model();
00090
00091 if (cellModel == prism)
00092 {
00093 forAll(cellShape, ip)
00094 {
00095 conn_array[nPen06][ip] = cellShape[ip] + 1;
00096 }
00097 nPen06++;
00098 }
00099 }
00100 }
00101
00102
00103
00104 else if (element_type == Z_PYR05)
00105 {
00106 const cellModel& pyr = *(cellModeller::lookup("pyr"));
00107
00108 label nPyr05 = 0;
00109 forAll(cellShapes, celli)
00110 {
00111 const cellShape& cellShape = cellShapes[celli];
00112 const cellModel& cellModel = cellShape.model();
00113
00114 if (cellModel == pyr)
00115 {
00116 forAll(cellShape, ip)
00117 {
00118 conn_array[nPyr05][ip] = cellShape[ip] + 1;
00119 }
00120 nPyr05++;
00121 }
00122 }
00123 }
00124
00125
00126
00127 else if (element_type == Z_TET04)
00128 {
00129 const cellModel& tet = *(cellModeller::lookup("tet"));
00130
00131 label nTet04 = 0;
00132 forAll(cellShapes, celli)
00133 {
00134 const cellShape& cellShape = cellShapes[celli];
00135 const cellModel& cellModel = cellShape.model();
00136
00137 if (cellModel == tet)
00138 {
00139 forAll(cellShape, ip)
00140 {
00141 conn_array[nTet04][ip] = cellShape[ip] + 1;
00142 }
00143 nTet04++;
00144 }
00145 }
00146 }
00147
00148
00149
00150 else
00151 {
00152 label nCells = cellShapes.size();
00153 label nFaced = 0;
00154 const cellList cells = meshPtr->cells();
00155
00156 for (label n=0; n<nCells; n++)
00157 {
00158 label nFacesInCell = cells[n].size();
00159 labelList points = cellShapes[n];
00160 if ((nFacesInCell == 6) && (points.size() == 8))
00161 {}
00162 else if ((nFacesInCell == 4) && (points.size() == 4))
00163 {}
00164 else if (nFacesInCell == 5)
00165 {
00166 if (points.size() == 6)
00167 {}
00168 else if (points.size() == 5)
00169 {}
00170 else
00171 {
00172 conn_array[nFaced++][0] = nFacesInCell;
00173 }
00174 }
00175 else
00176 {
00177 conn_array[nFaced++][0] = nFacesInCell;
00178 }
00179 }
00180 }
00181 }
00182 else if (part_number < nPatches+2)
00183 {
00184 label patchi = part_number - 2;
00185 const polyBoundaryMesh& bMesh = meshPtr->boundaryMesh();
00186
00187 label nTri03 = 0;
00188 label nQuad04 = 0;
00189 if (element_type == Z_TRI03)
00190 {
00191 forAll(bMesh[patchi], n)
00192 {
00193 label nPoints = bMesh[patchi][n].size();
00194 if (nPoints == 3)
00195 {
00196 for(label i=0; i<nPoints; i++)
00197 {
00198 label ip = bMesh[patchi][n][i];
00199 conn_array[nTri03][i] = ip + 1;
00200 }
00201 nTri03++;
00202 }
00203 }
00204 }
00205 else if (element_type == Z_QUA04)
00206 {
00207 forAll(bMesh[patchi], n)
00208 {
00209 label nPoints = bMesh[patchi][n].size();
00210 if (nPoints == 4)
00211 {
00212 for(label i=0; i<nPoints; i++)
00213 {
00214 label ip = bMesh[patchi][n][i];
00215 conn_array[nQuad04][i] = ip + 1;
00216 }
00217 nQuad04++;
00218 }
00219 }
00220
00221 }
00222 else if (element_type == Z_NSIDED)
00223 {
00224 label nPoly = 0;
00225 forAll(bMesh[patchi], n)
00226 {
00227 label nPoints = bMesh[patchi][n].size();
00228 if ((nPoints != 3) && (nPoints != 4))
00229 {
00230 conn_array[nPoly++][0] = nPoints;
00231 }
00232 }
00233 }
00234 }
00235 else if (part_number == nPatches+2)
00236 {
00237 for (label n=0; n<sprayPtr->size(); n++)
00238 {
00239 conn_array[n][0] = n + 1;
00240 }
00241 }
00242 else
00243 {
00244 return Z_ERR;
00245 }
00246
00247 # ifdef ENSIGHTDEBUG
00248 Info<< "Leaving: USERD_get_part_elements_by_type" << endl;
00249 # endif
00250
00251 return Z_OK;
00252 }
Copyright © 2000-2009 OpenCFD Ltd