OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

getFieldVector.H

Go to the documentation of this file.
00001 if (nVar >= Num_variables - nSprayVariables)
00002 {
00003     return Z_UNDEF;
00004 }
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 volVectorField vectorField
00030 (
00031     fieldObject,
00032     mesh
00033 );
00034 
00035 const cellShapeList& cellShapes = meshPtr->cellShapes();
00036 
00037 // hexa's
00038 if (which_type == Z_HEX08)
00039 {
00040     const cellModel& hex = *(cellModeller::lookup("hex"));
00041     //const cellModel& wedge = *(cellModeller::lookup("wedge"));
00042 
00043     label counter = 1;
00044     for (label n=0; n<nCells; n++)
00045     {
00046         const cellShape& cellShape = cellShapes[n];
00047         const cellModel& cellModel = cellShape.model();
00048         
00049         if (cellModel == hex) // || (cellModel == wedge))
00050         {
00051             var_array[counter++] = vectorField[n][component];
00052         }
00053     }
00054 }
00055 
00056 // penta's
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++] = vectorField[n][component];
00070         }
00071     }
00072 }
00073 
00074 // pyramids's
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++] = vectorField[n][component];
00088         }
00089     }
00090 }
00091 
00092 
00093 // tet's
00094 if (which_type == Z_TET04)
00095 {
00096     const cellModel& tet = *(cellModeller::lookup("tet"));
00097 
00098     label counter = 1;    
00099     for (label n=0; n<nCells; n++)
00100     {
00101         const cellShape& cellShape = cellShapes[n];
00102         const cellModel& cellModel = cellShape.model();
00103 
00104         if (cellModel == tet)
00105         {
00106             var_array[counter++] = vectorField[n][component];
00107         }
00108     }
00109 }
00110 
00111 if (which_type == Z_NFACED)
00112 {
00113     const cellList& cells = meshPtr->cells();
00114 
00115     label counter = 1;
00116     for (label n=0; n<nCells; n++)
00117     {
00118         const labelList& points = cellShapes[n];
00119         label nFacesInCell = cells[n].size();
00120 
00121         if ((nFacesInCell == 6) && (points.size() == 8))
00122         {}
00123         else if ((nFacesInCell == 4) && (points.size() == 4))
00124         {}
00125         else if (nFacesInCell == 5)
00126         {
00127             if (points.size() == 6)
00128             {}
00129             else if (points.size() == 5)
00130             {}
00131             else
00132             {
00133                 var_array[counter++] = vectorField[n][component];
00134             }
00135         }
00136         else
00137         {
00138             var_array[counter++] = vectorField[n][component];
00139         }
00140     }
00141 }
Copyright © 2000-2009 OpenCFD Ltd