getFieldScalar.H
Go to the documentation of this file.00001
00002 if (nVar >= Num_variables - nSprayVariables)
00003 {
00004 return Z_UNDEF;
00005 }
00006
00007 IOobject fieldObjectPtr
00008 (
00009 fieldNames[var2field[nVar]],
00010 runTime.timeName(),
00011 mesh,
00012 IOobject::NO_READ
00013 );
00014
00015 if (!fieldObjectPtr.headerOk())
00016 {
00017 return Z_UNDEF;
00018 }
00019
00020 IOobject fieldObject
00021 (
00022 fieldNames[var2field[nVar]],
00023 runTime.timeName(),
00024 mesh,
00025 IOobject::MUST_READ,
00026 IOobject::NO_WRITE
00027 );
00028
00029 volScalarField scalarField
00030 (
00031 fieldObject,
00032 mesh
00033 );
00034
00035 const cellShapeList& cellShapes = meshPtr->cellShapes();
00036
00037
00038 if (which_type == Z_HEX08)
00039 {
00040 const cellModel& hex = *(cellModeller::lookup("hex"));
00041
00042
00043 label counter = 1;
00044 for (label celli=0; celli<nCells; celli++)
00045 {
00046 const cellShape& cellShape = cellShapes[celli];
00047 const cellModel& cellModel = cellShape.model();
00048
00049 if (cellModel == hex)
00050 {
00051 var_array[counter++] = scalarField[celli];
00052 }
00053 }
00054 }
00055
00056
00057 if (which_type == Z_PEN06)
00058 {
00059 const cellModel& prism = *(cellModeller::lookup("prism"));
00060
00061 label counter = 1;
00062 for (label n=0; n<nCells; n++)
00063 {
00064 const cellShape& cellShape = cellShapes[n];
00065 const cellModel& cellModel = cellShape.model();
00066
00067 if (cellModel == prism)
00068 {
00069 var_array[counter++] = scalarField[n];
00070 }
00071 }
00072 }
00073
00074
00075 if (which_type == Z_PYR05)
00076 {
00077 const cellModel& pyr = *(cellModeller::lookup("pyr"));
00078
00079 label counter = 1;
00080 for (label n=0; n<nCells; n++)
00081 {
00082 const cellShape& cellShape = cellShapes[n];
00083 const cellModel& cellModel = cellShape.model();
00084
00085 if (cellModel == pyr)
00086 {
00087 var_array[counter++] = scalarField[n];
00088 }
00089 }
00090 }
00091
00092
00093 if (which_type == Z_TET04)
00094 {
00095 const cellModel& tet = *(cellModeller::lookup("tet"));
00096
00097 label counter = 1;
00098 for (label n=0; n<nCells; n++)
00099 {
00100 const cellShape& cellShape = cellShapes[n];
00101 const cellModel& cellModel = cellShape.model();
00102
00103 if (cellModel == tet)
00104 {
00105 var_array[counter++] = scalarField[n];
00106 }
00107 }
00108 }
00109
00110 if (which_type == Z_NFACED)
00111 {
00112 const cellList& cells = meshPtr->cells();
00113
00114 label counter = 1;
00115 for (label n=0; n<nCells; n++)
00116 {
00117 const labelList& points = cellShapes[n];
00118 label nFacesInCell = cells[n].size();
00119
00120 if ((nFacesInCell == 6) && (points.size() == 8))
00121 {}
00122 else if ((nFacesInCell == 4) && (points.size() == 4))
00123 {}
00124 else if (nFacesInCell == 5)
00125 {
00126 if (points.size() == 6)
00127 {}
00128 else if (points.size() == 5)
00129 {}
00130 else
00131 {
00132 var_array[counter++] = scalarField[n];
00133 }
00134 }
00135 else
00136 {
00137 var_array[counter++] = scalarField[n];
00138 }
00139 }
00140
00141 }
Copyright © 2000-2009 OpenCFD Ltd