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

USERD_get_gold_part_build_info.H

Go to the documentation of this file.
00001 //======================================================================
00002 // this is based on the current time step.
00003 //======================================================================
00004 int USERD_get_gold_part_build_info
00005 (
00006     int *part_numbers,
00007     int *part_types,
00008     char *part_descriptions[Z_BUFL],
00009     int *number_of_nodes,
00010     int *number_of_elements[Z_MAXTYPE],
00011     int *ijk_dimensions[3],
00012     int *iblanking_options[6]
00013 )
00014 {
00015 #ifdef ENSIGHTDEBUG
00016     Info << "Entering: USERD_get_gold_part_build_info" << endl << flush;
00017 #endif
00018 
00019     //#   include "checkForNewMesh.H"
00020 
00021     const cellShapeList& cellShapes = meshPtr->cellShapes();
00022     const cellList& cells = meshPtr->cells();
00023 
00024     label nCells = cells.size();
00025 
00026     // all parts are unstructured
00027     for (label n = 0; n<Numparts_available; n++)
00028     {
00029         part_numbers[n] = n + 1;
00030         part_types[n]   = Z_UNSTRUCTURED;
00031     }
00032 
00033     strncpy(part_descriptions[0], meshName, Z_BUFL);
00034 
00035     for(label i=0; i<nPatches; i++)
00036     {
00037         word patchName(meshPtr->boundary()[i].name());
00038         strncpy(part_descriptions[i+1], patchName.c_str(), Z_BUFL);
00039     }
00040 
00041     label nHex08 = 0;
00042     label nPen06 = 0;
00043     label nPyr05 = 0;
00044     label nTet04 = 0;
00045     label nFaced = 0;
00046 
00047     for (label n=0; n<nCells; n++)
00048     {
00049         label nFacesInCell = cells[n].size();
00050         labelList points = cellShapes[n];
00051 
00052         if ((nFacesInCell == 6) && (points.size() == 8))
00053         {
00054             nHex08++;
00055         }
00056         else if ((nFacesInCell == 4) && (points.size() == 4))
00057         {
00058             nTet04++;
00059         }
00060         else if (nFacesInCell == 5)
00061         {
00062             if (points.size() == 6)
00063             {
00064                 nPen06++;
00065             }
00066             else if (points.size() == 5)
00067             {
00068                 nPyr05++;
00069             }
00070             else
00071             {
00072                 nFaced++;
00073             }
00074         }
00075         else
00076         {
00077             nFaced++;
00078         }
00079     }
00080 
00081     for (label n=0; n < Z_MAXTYPE; n++)
00082     {
00083         for (label i=0; i<Numparts_available; i++)
00084         {
00085             number_of_elements[i][n] = 0;
00086         }
00087     }
00088 
00089     number_of_elements[0][Z_TET04] = nTet04;
00090     number_of_elements[0][Z_PYR05] = nPyr05;
00091     number_of_elements[0][Z_HEX08] = nHex08;
00092     number_of_elements[0][Z_PEN06] = nPen06;
00093     number_of_elements[0][Z_NFACED] = nFaced;
00094 
00095     /*
00096     Info << "nTet04 = " << nTet04 << endl;
00097     Info << "nPyr05 = " << nPyr05 << endl;
00098     Info << "nHex08 = " << nHex08 << endl;
00099     Info << "nPen06 = " << nPen06 << endl;
00100     Info << "nFaced = " << nFaced << endl;
00101         */
00102 
00103     number_of_nodes[0] = meshPtr->nPoints();
00104 
00105     const polyBoundaryMesh& bMesh = meshPtr->boundaryMesh();
00106 
00107     for(label i=0; i<nPatches; i++)
00108     {
00109         label nTri03 = 0;
00110         label nQuad04 = 0;
00111         label nPoly = 0;
00112 
00113         forAll(bMesh[i], n)
00114         {
00115             label nPoints = bMesh[i][n].size();
00116 
00117             if (nPoints == 3)
00118             {
00119                 nTri03++;
00120             }
00121             else  if (nPoints == 4)
00122             {
00123                 nQuad04++;
00124             }
00125             else
00126             {
00127                 nPoly++;
00128             }
00129         }
00130 
00131         number_of_elements[i+1][Z_TRI03] = nTri03;
00132         number_of_elements[i+1][Z_QUA04] = nQuad04;
00133         number_of_elements[i+1][Z_NSIDED] = nPoly;
00134 
00135         number_of_nodes[i+1] = bMesh[i].points().size();
00136     }
00137 
00138     if (Numparts_available > nPatches+1)
00139     {
00140         strncpy
00141         (
00142             part_descriptions[nPatches+1],
00143             cloud::prefix.c_str(),
00144             Z_BUFL
00145         );
00146         number_of_elements[nPatches+1][Z_POINT] = sprayPtr->size();
00147         number_of_nodes[nPatches+1] = sprayPtr->size();
00148     }
00149 
00150 #ifdef ENSIGHTDEBUG
00151     Info << "Leaving: USERD_get_gold_part_build_info" << endl << flush;
00152 #endif
00153 
00154     return Z_OK;
00155 }
00156 
Copyright © 2000-2009 OpenCFD Ltd