From 4bb11a28827da17304481822530d3898e019d741 Mon Sep 17 00:00:00 2001 From: andy <andy> Date: Mon, 11 Feb 2013 09:33:20 +0000 Subject: [PATCH] ENH: Removed fieldview reader/converter --- .../foamToFieldview9/Make/files | 7 - .../foamToFieldview9/Make/options | 10 - .../foamToFieldview9/calcFaceAddressing.C | 92 -- .../foamToFieldview9/calcFaceAddressing.H | 55 - .../foamToFieldview9/createFields.H | 197 --- .../foamToFieldview9/createSprayFields.H | 75 - .../foamToFieldview9/fieldviewTopology.C | 436 ------ .../foamToFieldview9/fieldviewTopology.H | 176 --- .../foamToFieldview9/foamToFieldview9.C | 1009 -------------- .../foamToFieldview9/fv_reader_tags.h | 37 - .../foamToFieldview9/getFieldNames.H | 68 - .../foamToFieldview9/moveMesh.H | 34 - .../foamToFieldview9/writeFunctions.C | 97 -- .../foamToFieldview9/writeFunctions.H | 56 - .../foamToFieldview9/writeSprayHeader.H | 26 - .../foamToFieldview9/write_binary_uns.c | 641 --------- .../graphics/fieldview9Reader/Allwmake | 10 - .../graphics/fieldview9Reader/Make/files | 5 - .../graphics/fieldview9Reader/Make/options | 103 -- .../graphics/fieldview9Reader/README | 56 - .../graphics/fieldview9Reader/errno.c | 1 - .../fieldview9Reader/fieldview9Reader.C | 1209 ----------------- .../fieldview9Reader/readerDatabase.C | 340 ----- .../fieldview9Reader/readerDatabase.H | 172 --- 24 files changed, 4912 deletions(-) delete mode 100644 applications/utilities/postProcessing/dataConversion/foamToFieldview9/Make/files delete mode 100644 applications/utilities/postProcessing/dataConversion/foamToFieldview9/Make/options delete mode 100644 applications/utilities/postProcessing/dataConversion/foamToFieldview9/calcFaceAddressing.C delete mode 100644 applications/utilities/postProcessing/dataConversion/foamToFieldview9/calcFaceAddressing.H delete mode 100644 applications/utilities/postProcessing/dataConversion/foamToFieldview9/createFields.H delete mode 100644 applications/utilities/postProcessing/dataConversion/foamToFieldview9/createSprayFields.H delete mode 100644 applications/utilities/postProcessing/dataConversion/foamToFieldview9/fieldviewTopology.C delete mode 100644 applications/utilities/postProcessing/dataConversion/foamToFieldview9/fieldviewTopology.H delete mode 100644 applications/utilities/postProcessing/dataConversion/foamToFieldview9/foamToFieldview9.C delete mode 100644 applications/utilities/postProcessing/dataConversion/foamToFieldview9/fv_reader_tags.h delete mode 100644 applications/utilities/postProcessing/dataConversion/foamToFieldview9/getFieldNames.H delete mode 100644 applications/utilities/postProcessing/dataConversion/foamToFieldview9/moveMesh.H delete mode 100644 applications/utilities/postProcessing/dataConversion/foamToFieldview9/writeFunctions.C delete mode 100644 applications/utilities/postProcessing/dataConversion/foamToFieldview9/writeFunctions.H delete mode 100644 applications/utilities/postProcessing/dataConversion/foamToFieldview9/writeSprayHeader.H delete mode 100644 applications/utilities/postProcessing/dataConversion/foamToFieldview9/write_binary_uns.c delete mode 100755 applications/utilities/postProcessing/graphics/fieldview9Reader/Allwmake delete mode 100644 applications/utilities/postProcessing/graphics/fieldview9Reader/Make/files delete mode 100644 applications/utilities/postProcessing/graphics/fieldview9Reader/Make/options delete mode 100644 applications/utilities/postProcessing/graphics/fieldview9Reader/README delete mode 100644 applications/utilities/postProcessing/graphics/fieldview9Reader/errno.c delete mode 100644 applications/utilities/postProcessing/graphics/fieldview9Reader/fieldview9Reader.C delete mode 100644 applications/utilities/postProcessing/graphics/fieldview9Reader/readerDatabase.C delete mode 100644 applications/utilities/postProcessing/graphics/fieldview9Reader/readerDatabase.H diff --git a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/Make/files b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/Make/files deleted file mode 100644 index 86d2d39d74d..00000000000 --- a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/Make/files +++ /dev/null @@ -1,7 +0,0 @@ -foamToFieldview9.C -fieldviewTopology.C -write_binary_uns.c -calcFaceAddressing.C -writeFunctions.C - -EXE = $(FOAM_APPBIN)/foamToFieldview9 diff --git a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/Make/options b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/Make/options deleted file mode 100644 index 0bc784e4c51..00000000000 --- a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/Make/options +++ /dev/null @@ -1,10 +0,0 @@ -EXE_INC = \ - -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/lagrangian/basic/lnInclude - -EXE_LIBS = \ - -lfiniteVolume \ - -lmeshTools \ - -lgenericPatchFields \ - -llagrangian diff --git a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/calcFaceAddressing.C b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/calcFaceAddressing.C deleted file mode 100644 index cbe425d4a8b..00000000000 --- a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/calcFaceAddressing.C +++ /dev/null @@ -1,92 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#include "calcFaceAddressing.H" - -using namespace Foam; - -// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * // - -// Returns the face labels of the shape in an order consistent with the -// shape. -labelList calcFaceAddressing -( - const faceList& allFaces, // faces given faceLabels - const cellShape& shape, - const labelList& faces, // faceLabels for given cell - const label cellI -) -{ - // return value. - labelList shapeToMesh(shape.nFaces(), -1); - - const faceList modelFaces(shape.faces()); - - // Loop over all faces of cellShape - forAll(modelFaces, cellFaceI) - { - // face (vertex list) - const face& modelFace = modelFaces[cellFaceI]; - - // Loop over all face labels - forAll(faces, faceI) - { - const face& vertLabels = allFaces[faces[faceI]]; - - if (vertLabels == modelFace) - { - //Info<< "match:" << modelFace - // << " to " << vertLabels << endl; - shapeToMesh[cellFaceI] = faces[faceI]; - break; - } - } - - if (shapeToMesh[cellFaceI] == -1) - { - FatalErrorIn("foamToFieldview : calcFaceAddressing") - << "calcFaceAddressing : can't match face to shape.\n" - << " shape face:" << modelFace << endl - << " face labels:" << faces << endl - << " cellI:" << cellI << endl; - - FatalError - << "Faces consist of vertices:" << endl; - - forAll(faces, faceI) - { - FatalError - << " face:" << faces[faceI] - << allFaces[faces[faceI]] << endl; - } - FatalError - << exit(FatalError); - } - } - return shapeToMesh; -} - - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/calcFaceAddressing.H b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/calcFaceAddressing.H deleted file mode 100644 index f3647986c92..00000000000 --- a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/calcFaceAddressing.H +++ /dev/null @@ -1,55 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -InClass - Foam::calcFaceAddressing - -Description - -SourceFiles - calcFaceAddressing.C - -\*---------------------------------------------------------------------------*/ - -#ifndef calcFaceAddressing_H -#define calcFaceAddressing_H - -#include "faceList.H" -#include "cellShape.H" -#include "labelList.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -Foam::labelList calcFaceAddressing -( - const Foam::faceList& allFaces, // faces given faceLabels - const Foam::cellShape& shape, - const Foam::labelList& faces, // faceLabels for given cell - const Foam::label cellI -); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/createFields.H b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/createFields.H deleted file mode 100644 index 77f5f0ebc9a..00000000000 --- a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/createFields.H +++ /dev/null @@ -1,197 +0,0 @@ -// Construct List of pointers to all vol fields -int nFields = volScalarNames.size() + 3*volVectorNames.size(); -List<volScalarField*> volFieldPtrs -( - nFields, - reinterpret_cast<volScalarField*>(0) -); - -stringList volFieldNames(nFields); - -nFields = 0; -{ - // Load all scalar fields and store ptr to it - forAll(volScalarNames, fieldI) - { - word fieldName = volScalarNames[fieldI]; - - // Check if present - IOobject ioHeader - ( - fieldName, - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::NO_WRITE - ); - - if (ioHeader.headerOk()) - { - volFieldPtrs[nFields] = new volScalarField - ( - ioHeader, - mesh - ); - } - - fieldName = getFieldViewName(fieldName); - - volFieldNames[nFields] = fieldName; - - nFields++; - } - - - // Load all (componenents of) vector fields - forAll(volVectorNames, fieldI) - { - word fieldName = volVectorNames[fieldI]; - - // Check if present - IOobject ioHeader - ( - fieldName, - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::NO_WRITE - ); - - if (ioHeader.headerOk()) - { - volVectorField vvf(ioHeader, mesh); - - // X component - volFieldPtrs[nFields] = - new volScalarField - ( - vvf.component(vector::X) - ); - - // Y component - volFieldPtrs[nFields+1] = - new volScalarField - ( - vvf.component(vector::Y) - ); - - // Z component - volFieldPtrs[nFields+2] = - new volScalarField - ( - vvf.component(vector::Z) - ); - } - - fieldName = getFieldViewName(fieldName); - - volFieldNames[nFields] = fieldName + ("x;" + fieldName); - volFieldNames[nFields+1] = fieldName + "y"; - volFieldNames[nFields+2] = fieldName + "z"; - - nFields += 3; - } -} - - - -// -// Construct List of pointers to all surface fields -// - - - -int nSurfFields = surfScalarNames.size() + 3*surfVectorNames.size(); -List<surfaceScalarField*> surfFieldPtrs -( - nSurfFields, - reinterpret_cast<surfaceScalarField*>(0) -); - -stringList surfFieldNames(nSurfFields); - -nSurfFields = 0; -{ - // Load all scalar fields - forAll(surfScalarNames, fieldI) - { - word fieldName = surfScalarNames[fieldI]; - - // Check if present - IOobject ioHeader - ( - fieldName, - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::NO_WRITE - ); - - if (ioHeader.headerOk()) - { - surfFieldPtrs[nSurfFields] = - new surfaceScalarField - ( - ioHeader, - mesh - ); - } - - fieldName = getFieldViewName(fieldName); - - surfFieldNames[nSurfFields] = fieldName; - - nSurfFields++; - } - - - // Set (componenents of) vector fields - forAll(surfVectorNames, fieldI) - { - word fieldName = surfVectorNames[fieldI]; - - // Check if present - IOobject ioHeader - ( - fieldName, - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::NO_WRITE - ); - - if (ioHeader.headerOk()) - { - surfaceVectorField svf(ioHeader, mesh); - - // X component - surfFieldPtrs[nSurfFields] = - new surfaceScalarField - ( - svf.component(vector::X) - ); - - // Y component - surfFieldPtrs[nSurfFields+1] = - new surfaceScalarField - ( - svf.component(vector::Y) - ); - - // Z component - surfFieldPtrs[nSurfFields+2] = - new surfaceScalarField - ( - svf.component(vector::Z) - ); - } - - fieldName = getFieldViewName(fieldName); - - surfFieldNames[nSurfFields] = fieldName + ("x;" + fieldName); - surfFieldNames[nSurfFields+1] = fieldName + "y"; - surfFieldNames[nSurfFields+2] = fieldName + "z"; - - nSurfFields += 3; - } -} diff --git a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/createSprayFields.H b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/createSprayFields.H deleted file mode 100644 index a5a218de804..00000000000 --- a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/createSprayFields.H +++ /dev/null @@ -1,75 +0,0 @@ -// Construct of ptrs to all spray fields -List<IOField<scalar>* > sprayScalarFieldPtrs -( - sprayScalarNames.size(), - reinterpret_cast<IOField<scalar>*>(0) -); - -List<IOField<vector>* > sprayVectorFieldPtrs -( - sprayVectorNames.size(), - reinterpret_cast<IOField<vector>*>(0) -); - -{ - int sprayFieldI = 0; - - // Set scalar fields - forAll(sprayScalarNames, fieldI) - { - IOobject ioHeader - ( - sprayScalarNames[fieldI], - runTime.timeName(), - cloud::prefix, - mesh, - IOobject::MUST_READ, - IOobject::NO_WRITE - ); - - if (ioHeader.headerOk()) - { - sprayScalarFieldPtrs[sprayFieldI] = new IOField<scalar>(ioHeader); - } - else - { - Info<< " dummy lagrangian field for " - << sprayScalarNames[fieldI] << endl; - } - - sprayFieldI++; - } -} - - -// Set vector fields - -{ - int sprayFieldI = 0; - - forAll(sprayVectorNames, fieldI) - { - IOobject ioHeader - ( - sprayVectorNames[fieldI], - runTime.timeName(), - cloud::prefix, - mesh, - IOobject::MUST_READ, - IOobject::NO_WRITE - ); - - if (ioHeader.headerOk()) - { - sprayVectorFieldPtrs[sprayFieldI] = new IOField<vector>(ioHeader); - } - else - { - Info<< " dummy lagrangian field for " - << sprayVectorNames[fieldI] << endl; - } - - sprayFieldI++; - } -} - diff --git a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/fieldviewTopology.C b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/fieldviewTopology.C deleted file mode 100644 index ec31f67ed53..00000000000 --- a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/fieldviewTopology.C +++ /dev/null @@ -1,436 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#include "fieldviewTopology.H" -#include "polyMesh.H" -#include "cellShape.H" -#include "cellModeller.H" -#include "wallPolyPatch.H" -#include "symmetryPolyPatch.H" - - -#include "fv_reader_tags.h" - -extern "C" -{ - unsigned int fv_encode_elem_header(int elem_type, int wall_info[]); -} - - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -Foam::labelList Foam::fieldviewTopology::calcFaceAddressing -( - const faceList& allFaces, // faces given faceLabels - const cellShape& shape, - const labelList& faces, // faceLabels for given cell - const label cellI -) -{ - // return value. - labelList shapeToMesh(shape.nFaces(), -1); - - const faceList modelFaces(shape.faces()); - - // Loop over all faces of cellShape - forAll(modelFaces, cellFaceI) - { - // face (vertex list) - const face& modelFace = modelFaces[cellFaceI]; - - // Loop over all face labels - forAll(faces, faceI) - { - const face& vertLabels = allFaces[faces[faceI]]; - - if (vertLabels == modelFace) - { - shapeToMesh[cellFaceI] = faces[faceI]; - break; - } - } - - if (shapeToMesh[cellFaceI] == -1) - { - FatalErrorIn("foamToFieldview : calcFaceAddressing") - << "calcFaceAddressing : can't match face to shape.\n" - << " shape face:" << modelFace << endl - << " face labels:" << faces << endl - << " cellI:" << cellI << endl; - - FatalError << "Faces consist of vertices:" << endl; - forAll(faces, faceI) - { - FatalError - << " face:" << faces[faceI] - << allFaces[faces[faceI]] << endl; - } - FatalError << exit(FatalError); - } - } - return shapeToMesh; -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -// Construct from components -Foam::fieldviewTopology::fieldviewTopology -( - const polyMesh& mesh, - const bool setWallInfo -) -: - hexLabels_((1+8)*mesh.nCells()), - prismLabels_((1+6)*mesh.nCells()), - pyrLabels_((1+5)*mesh.nCells()), - tetLabels_((1+4)*mesh.nCells()), - nPoly_(0), - quadFaceLabels_(mesh.boundaryMesh().size()), - nPolyFaces_(mesh.boundaryMesh().size()) -{ - // Mark all faces that are to be seen as wall for particle - // tracking and all cells that use one or more of these walls - - List<int> wallFace(mesh.nFaces(), NOT_A_WALL); - boolList wallCell(mesh.nCells(), false); - - if (setWallInfo) - { - forAll(mesh.boundaryMesh(), patchI) - { - const polyPatch& currPatch = mesh.boundaryMesh()[patchI]; - if - ( - isA<wallPolyPatch>(currPatch) - || isA<symmetryPolyPatch>(currPatch) - ) - { - forAll(currPatch, patchFaceI) - { - label meshFaceI = currPatch.start() + patchFaceI; - - wallFace[meshFaceI] = A_WALL; - wallCell[mesh.faceOwner()[meshFaceI]] = true; - } - } - } - } - - - - const cellModel& tet = *(cellModeller::lookup("tet")); - const cellModel& pyr = *(cellModeller::lookup("pyr")); - const cellModel& prism = *(cellModeller::lookup("prism")); - const cellModel& wedge = *(cellModeller::lookup("wedge")); - const cellModel& tetWedge = *(cellModeller::lookup("tetWedge")); - const cellModel& hex = *(cellModeller::lookup("hex")); - - // Pre calculate headers for cells not on walls - List<int> notWallFlags(6, NOT_A_WALL); - unsigned int tetNotWall = fv_encode_elem_header - ( - FV_TET_ELEM_ID, notWallFlags.begin() - ); - unsigned int pyrNotWall = fv_encode_elem_header - ( - FV_PYRA_ELEM_ID, notWallFlags.begin() - ); - unsigned int prismNotWall = fv_encode_elem_header - ( - FV_PRISM_ELEM_ID, notWallFlags.begin() - ); - unsigned int hexNotWall = fv_encode_elem_header - ( - FV_HEX_ELEM_ID, notWallFlags.begin() - ); - - // Some aliases - const cellList& cellFaces = mesh.cells(); - const cellShapeList& cellShapes = mesh.cellShapes(); - - - label hexi = 0; - label prismi = 0; - label pyri = 0; - label teti = 0; - - const faceList& allFaces = mesh.faces(); - - List<int> wallFlags(6); - forAll(cellShapes, celli) - { - const cellShape& cellShape = cellShapes[celli]; - const cellModel& cellModel = cellShape.model(); - - if (cellModel == tet) - { - if (!wallCell[celli]) - { - tetLabels_[teti++] = tetNotWall; - } - else - { - labelList modelToMesh = calcFaceAddressing - ( - allFaces, cellShape, cellFaces[celli], celli - ); - - wallFlags[0] = wallFace[modelToMesh[0]]; - wallFlags[1] = wallFace[modelToMesh[1]]; - wallFlags[2] = wallFace[modelToMesh[2]]; - wallFlags[3] = wallFace[modelToMesh[3]]; - - tetLabels_[teti++] = fv_encode_elem_header - ( - FV_TET_ELEM_ID, wallFlags.begin() - ); - } - - tetLabels_[teti++] = cellShape[0] + 1; - tetLabels_[teti++] = cellShape[1] + 1; - tetLabels_[teti++] = cellShape[2] + 1; - tetLabels_[teti++] = cellShape[3] + 1; - } - else if (cellModel == pyr) - { - if (!wallCell[celli]) - { - pyrLabels_[pyri++] = pyrNotWall; - } - else - { - labelList modelToMesh = calcFaceAddressing - ( - allFaces, cellShape, cellFaces[celli], celli - ); - - wallFlags[0] = wallFace[modelToMesh[0]]; - wallFlags[1] = wallFace[modelToMesh[3]]; - wallFlags[2] = wallFace[modelToMesh[2]]; - wallFlags[3] = wallFace[modelToMesh[1]]; - wallFlags[4] = wallFace[modelToMesh[4]]; - - pyrLabels_[pyri++] = fv_encode_elem_header - ( - FV_PYRA_ELEM_ID, wallFlags.begin() - ); - } - - pyrLabels_[pyri++] = cellShape[0] + 1; - pyrLabels_[pyri++] = cellShape[1] + 1; - pyrLabels_[pyri++] = cellShape[2] + 1; - pyrLabels_[pyri++] = cellShape[3] + 1; - pyrLabels_[pyri++] = cellShape[4] + 1; - } - else if (cellModel == prism) - { - if (!wallCell[celli]) - { - prismLabels_[prismi++] = prismNotWall; - } - else - { - labelList modelToMesh = calcFaceAddressing - ( - allFaces, cellShape, cellFaces[celli], celli - ); - - wallFlags[0] = wallFace[modelToMesh[4]]; - wallFlags[1] = wallFace[modelToMesh[2]]; - wallFlags[2] = wallFace[modelToMesh[3]]; - wallFlags[3] = wallFace[modelToMesh[0]]; - wallFlags[4] = wallFace[modelToMesh[1]]; - - prismLabels_[prismi++] = fv_encode_elem_header - ( - FV_PRISM_ELEM_ID, wallFlags.begin() - ); - } - - prismLabels_[prismi++] = cellShape[0] + 1; - prismLabels_[prismi++] = cellShape[3] + 1; - prismLabels_[prismi++] = cellShape[4] + 1; - prismLabels_[prismi++] = cellShape[1] + 1; - prismLabels_[prismi++] = cellShape[5] + 1; - prismLabels_[prismi++] = cellShape[2] + 1; - } - else if (cellModel == tetWedge) - { - // Treat as prism with collapsed edge - if (!wallCell[celli]) - { - prismLabels_[prismi++] = prismNotWall; - } - else - { - labelList modelToMesh = calcFaceAddressing - ( - allFaces, cellShape, cellFaces[celli], celli - ); - - wallFlags[0] = wallFace[modelToMesh[1]]; - wallFlags[1] = wallFace[modelToMesh[2]]; - wallFlags[2] = wallFace[modelToMesh[3]]; - wallFlags[3] = wallFace[modelToMesh[0]]; - wallFlags[4] = wallFace[modelToMesh[3]]; - - prismLabels_[prismi++] = fv_encode_elem_header - ( - FV_PRISM_ELEM_ID, wallFlags.begin() - ); - } - - prismLabels_[prismi++] = cellShape[0] + 1; - prismLabels_[prismi++] = cellShape[3] + 1; - prismLabels_[prismi++] = cellShape[4] + 1; - prismLabels_[prismi++] = cellShape[1] + 1; - prismLabels_[prismi++] = cellShape[4] + 1; - prismLabels_[prismi++] = cellShape[2] + 1; - } - else if (cellModel == wedge) - { - if (!wallCell[celli]) - { - hexLabels_[hexi++] = hexNotWall; - } - else - { - labelList modelToMesh = calcFaceAddressing - ( - allFaces, cellShape, cellFaces[celli], celli - ); - - wallFlags[0] = wallFace[modelToMesh[2]]; - wallFlags[1] = wallFace[modelToMesh[3]]; - wallFlags[2] = wallFace[modelToMesh[0]]; - wallFlags[3] = wallFace[modelToMesh[1]]; - wallFlags[4] = wallFace[modelToMesh[4]]; - wallFlags[5] = wallFace[modelToMesh[5]]; - - hexLabels_[hexi++] = fv_encode_elem_header - ( - FV_HEX_ELEM_ID, wallFlags.begin() - ); - } - hexLabels_[hexi++] = cellShape[0] + 1; - hexLabels_[hexi++] = cellShape[1] + 1; - hexLabels_[hexi++] = cellShape[0] + 1; - hexLabels_[hexi++] = cellShape[2] + 1; - hexLabels_[hexi++] = cellShape[3] + 1; - hexLabels_[hexi++] = cellShape[4] + 1; - hexLabels_[hexi++] = cellShape[6] + 1; - hexLabels_[hexi++] = cellShape[5] + 1; - } - else if (cellModel == hex) - { - if (!wallCell[celli]) - { - hexLabels_[hexi++] = hexNotWall; - } - else - { - labelList modelToMesh = calcFaceAddressing - ( - allFaces, cellShape, cellFaces[celli], celli - ); - - wallFlags[0] = wallFace[modelToMesh[0]]; - wallFlags[1] = wallFace[modelToMesh[1]]; - wallFlags[2] = wallFace[modelToMesh[4]]; - wallFlags[3] = wallFace[modelToMesh[5]]; - wallFlags[4] = wallFace[modelToMesh[2]]; - wallFlags[5] = wallFace[modelToMesh[3]]; - - hexLabels_[hexi++] = fv_encode_elem_header - ( - FV_HEX_ELEM_ID, wallFlags.begin() - ); - } - hexLabels_[hexi++] = cellShape[0] + 1; - hexLabels_[hexi++] = cellShape[1] + 1; - hexLabels_[hexi++] = cellShape[3] + 1; - hexLabels_[hexi++] = cellShape[2] + 1; - hexLabels_[hexi++] = cellShape[4] + 1; - hexLabels_[hexi++] = cellShape[5] + 1; - hexLabels_[hexi++] = cellShape[7] + 1; - hexLabels_[hexi++] = cellShape[6] + 1; - } - else - { - nPoly_++; - } - } - - hexLabels_.setSize(hexi); - prismLabels_.setSize(prismi); - pyrLabels_.setSize(pyri); - tetLabels_.setSize(teti); - - - // - // Patches - // - forAll(mesh.boundaryMesh(), patchI) - { - const polyPatch& patchFaces = mesh.boundaryMesh()[patchI]; - - labelList& faceLabels = quadFaceLabels_[patchI]; - - // Faces, each 4 labels. Size big enough - faceLabels.setSize(patchFaces.size()*4); - - label labelI = 0; - - forAll(patchFaces, faceI) - { - const face& patchFace = patchFaces[faceI]; - - if (patchFace.size() == 3) - { - faceLabels[labelI++] = patchFace[0] + 1; - faceLabels[labelI++] = patchFace[1] + 1; - faceLabels[labelI++] = patchFace[2] + 1; - faceLabels[labelI++] = 0; // Fieldview:triangle definition - } - else if (patchFace.size() == 4) - { - faceLabels[labelI++] = patchFace[0] + 1; - faceLabels[labelI++] = patchFace[1] + 1; - faceLabels[labelI++] = patchFace[2] + 1; - faceLabels[labelI++] = patchFace[3] + 1; - } - } - - faceLabels.setSize(labelI); - - label nFaces = labelI/4; - - nPolyFaces_[patchI] = patchFaces.size() - nFaces; - } -} - - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/fieldviewTopology.H b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/fieldviewTopology.H deleted file mode 100644 index d0591a35412..00000000000 --- a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/fieldviewTopology.H +++ /dev/null @@ -1,176 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -Class - Foam::fieldviewTopology - -Description - -SourceFiles - fieldviewTopology.C - -\*---------------------------------------------------------------------------*/ - -#ifndef fieldviewTopology_H -#define fieldviewTopology_H - -#include "labelList.H" -#include "faceList.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// Forward declaration of classes -class polyMesh; -class cellShape; - -/*---------------------------------------------------------------------------*\ - Class fieldviewTopology Declaration -\*---------------------------------------------------------------------------*/ - -class fieldviewTopology -{ - // Private data - - //- Hexes in fieldview format - List<int> hexLabels_; - - List<int> prismLabels_; - - List<int> pyrLabels_; - - List<int> tetLabels_; - - //- Number of non-hex/prism/pyr/tet labels - label nPoly_; - - - // - // Patches - // - - //- Quad and tri patch faces in fv format - labelListList quadFaceLabels_; - - //- Number of polyhedral faces per patch - labelList nPolyFaces_; - - - // Private Member Functions - - static labelList calcFaceAddressing - ( - const faceList& allFaces, // faces given faceLabels - const cellShape& shape, - const labelList& faces, // faceLabels for given cell - const label cellI - ); - - - //- Disallow default bitwise copy construct - fieldviewTopology(const fieldviewTopology&); - - //- Disallow default bitwise assignment - void operator=(const fieldviewTopology&); - - -public: - - // Constructors - - //- Construct from components - fieldviewTopology(const polyMesh& mesh, const bool setWallInfo); - - - // Member Functions - - // Access - - const List<int>& hexLabels() const - { - return hexLabels_; - } - - const List<int>& prismLabels() const - { - return prismLabels_; - } - - const List<int>& pyrLabels() const - { - return pyrLabels_; - } - - const List<int>& tetLabels() const - { - return tetLabels_; - } - - label nHex() const - { - return hexLabels().size()/9; - } - - label nPrism() const - { - return prismLabels().size()/7; - } - - label nPyr() const - { - return pyrLabels().size()/6; - } - - label nTet() const - { - return tetLabels().size()/5; - } - - label nPoly() const - { - return nPoly_; - } - - const labelListList& quadFaceLabels() const - { - return quadFaceLabels_; - } - - const labelList& nPolyFaces() const - { - return nPolyFaces_; - } -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/foamToFieldview9.C b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/foamToFieldview9.C deleted file mode 100644 index 9b872ab1342..00000000000 --- a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/foamToFieldview9.C +++ /dev/null @@ -1,1009 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -Description - Write out the OpenFOAM mesh in Version 3.0 Fieldview-UNS format (binary). - - See Fieldview Release 9 Reference Manual - Appendix D - (Unstructured Data Format) - Borrows various from uns/write_binary_uns.c from FieldView dist. - -\*---------------------------------------------------------------------------*/ - -#include "argList.H" -#include "timeSelector.H" -#include "volFields.H" -#include "surfaceFields.H" -#include "pointFields.H" -#include "scalarIOField.H" -#include "volPointInterpolation.H" -#include "wallFvPatch.H" -#include "symmetryFvPatch.H" - -#include "Cloud.H" -#include "passiveParticle.H" - -#include "IOobjectList.H" -#include "boolList.H" -#include "stringList.H" -#include "cellModeller.H" - -#include "floatScalar.H" -#include "calcFaceAddressing.H" -#include "writeFunctions.H" -#include "fieldviewTopology.H" - -#include <fstream> - -#include "fv_reader_tags.h" - -extern "C" -{ - unsigned int fv_encode_elem_header(int elem_type, int wall_info[]); -} - -using namespace Foam; - -typedef Field<floatScalar> floatField; - - -static HashTable<word> FieldviewNames; - - -static word getFieldViewName(const word& foamName) -{ - if (FieldviewNames.found(foamName)) - { - return FieldviewNames[foamName]; - } - else - { - return foamName; - } -} - - -static void printNames(const wordList& names, Ostream& os) -{ - forAll(names, fieldI) - { - Info<< " " << names[fieldI] << '/' << getFieldViewName(names[fieldI]); - } -} - - -// Count number of vertices used by celli -static label countVerts(const primitiveMesh& mesh, const label celli) -{ - const cell& cll = mesh.cells()[celli]; - - // Count number of vertices used - labelHashSet usedVerts(10*cll.size()); - - forAll(cll, cellFacei) - { - const face& f = mesh.faces()[cll[cellFacei]]; - - forAll(f, fp) - { - if (!usedVerts.found(f[fp])) - { - usedVerts.insert(f[fp]); - } - } - } - return usedVerts.toc().size(); -} - - -static void writeFaceData -( - const polyMesh& mesh, - const fieldviewTopology& topo, - const label patchI, - const scalarField& patchField, - const bool writePolyFaces, - std::ofstream& fvFile -) -{ - const polyPatch& pp = mesh.boundaryMesh()[patchI]; - - // Start off with dummy value. - if (writePolyFaces) - { - floatField fField(topo.nPolyFaces()[patchI], 0.0); - - // Fill selected faces with field values - label polyFaceI = 0; - forAll(patchField, faceI) - { - if (pp[faceI].size() > 4) - { - fField[polyFaceI++] = float(patchField[faceI]); - } - } - - fvFile.write - ( - reinterpret_cast<char*>(fField.begin()), fField.size()*sizeof(float) - ); - } - else - { - floatField fField(pp.size() - topo.nPolyFaces()[patchI], 0.0); - - // Fill selected faces with field values - label quadFaceI = 0; - forAll(patchField, faceI) - { - if (pp[faceI].size() <= 4) - { - fField[quadFaceI++] = float(patchField[faceI]); - } - } - - fvFile.write - ( - reinterpret_cast<char*>(fField.begin()), fField.size()*sizeof(float) - ); - } -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// Main program: - -int main(int argc, char *argv[]) -{ - argList::noParallel(); - argList::addBoolOption - ( - "noWall", - "skip setting wall information" - ); - timeSelector::addOptions(true, false); - -# include "addRegionOption.H" - -# include "setRootCase.H" -# include "createTime.H" - - instantList timeDirs = timeSelector::select0(runTime, args); - -# include "createNamedMesh.H" - - // Initialize name mapping table - FieldviewNames.insert("alpha", "aalpha"); - FieldviewNames.insert("Alpha", "AAlpha"); - FieldviewNames.insert("fsmach", "ffsmach"); - FieldviewNames.insert("FSMach", "FFSMach"); - FieldviewNames.insert("re", "rre"); - FieldviewNames.insert("Re", "RRe"); - FieldviewNames.insert("time", "ttime"); - FieldviewNames.insert("Time", "TTime"); - FieldviewNames.insert("pi", "ppi"); - FieldviewNames.insert("PI", "PPI"); - FieldviewNames.insert("x", "xx"); - FieldviewNames.insert("X", "XX"); - FieldviewNames.insert("y", "yy"); - FieldviewNames.insert("Y", "YY"); - FieldviewNames.insert("z", "zz"); - FieldviewNames.insert("Z", "ZZ"); - FieldviewNames.insert("rcyl", "rrcyl"); - FieldviewNames.insert("Rcyl", "RRcyl"); - FieldviewNames.insert("theta", "ttheta"); - FieldviewNames.insert("Theta", "TTheta"); - FieldviewNames.insert("rsphere", "rrsphere"); - FieldviewNames.insert("Rsphere", "RRsphere"); - FieldviewNames.insert("k", "kk"); - FieldviewNames.insert("K", "KK"); - - - // Scan for all available fields, in all timesteps - // volScalarNames : all scalar fields - // volVectorNames : ,, vector ,, - // surfScalarNames : surface fields - // surfVectorNames : ,, - // sprayScalarNames: spray fields - // sprayVectorNames: ,, -# include "getFieldNames.H" - - bool hasLagrangian = false; - if (sprayScalarNames.size() || sprayVectorNames.size()) - { - hasLagrangian = true; - } - - Info<< "All fields: Foam/Fieldview" << endl; - Info<< " volScalar :"; - printNames(volScalarNames, Info); - Info<< endl; - Info<< " volVector :"; - printNames(volVectorNames, Info); - Info<< endl; - Info<< " surfScalar :"; - printNames(surfScalarNames, Info); - Info<< endl; - Info<< " surfVector :"; - printNames(surfVectorNames, Info); - Info<< endl; - Info<< " sprayScalar :"; - printNames(sprayScalarNames, Info); - Info<< endl; - Info<< " sprayVector :"; - printNames(sprayVectorNames, Info); - Info<< endl; - - - // - // Start writing - // - - // make a directory called FieldView in the case - fileName fvPath(runTime.path()/"Fieldview"); - - if (regionName != polyMesh::defaultRegion) - { - fvPath = fvPath/regionName; - } - - if (isDir(fvPath)) - { - if (regionName != polyMesh::defaultRegion) - { - Info<< "Keeping old FieldView files in " << fvPath << nl << endl; - } - else - { - Info<< "Deleting old FieldView files in " << fvPath << nl << endl; - rmDir(fvPath); - } - } - - mkDir(fvPath); - - fileName fvParticleFileName(fvPath/runTime.caseName() + ".fvp"); - if (hasLagrangian) - { - Info<< "Opening particle file " << fvParticleFileName << endl; - } - std::ofstream fvParticleFile(fvParticleFileName.c_str()); - - // Write spray file header - if (hasLagrangian) - { -# include "writeSprayHeader.H" - } - - // Current mesh. Start off from unloaded mesh. - autoPtr<fieldviewTopology> topoPtr(NULL); - - label fieldViewTime = 0; - - forAll(timeDirs, timeI) - { - runTime.setTime(timeDirs[timeI], timeI); - Info<< "Time: " << runTime.timeName() << endl; - - fvMesh::readUpdateState state = mesh.readUpdate(); - - if - ( - timeI == 0 - || state == fvMesh::TOPO_CHANGE - || state == fvMesh::TOPO_PATCH_CHANGE - ) - { - // Mesh topo changed. Update Fieldview topo. - - topoPtr.reset - ( - new fieldviewTopology - ( - mesh, - !args.optionFound("noWall") - ) - ); - - Info<< " Mesh read:" << endl - << " tet : " << topoPtr().nTet() << endl - << " hex : " << topoPtr().nHex() << endl - << " prism : " << topoPtr().nPrism() << endl - << " pyr : " << topoPtr().nPyr() << endl - << " poly : " << topoPtr().nPoly() << endl - << endl; - } - else if (state == fvMesh::POINTS_MOVED) - { - // points exists for time step, let's read them - Info<< " Points file detected - updating points" << endl; - } - - const fieldviewTopology& topo = topoPtr(); - - - // - // Create file and write header - // - - fileName fvFileName - ( - fvPath/runTime.caseName() + "_" + Foam::name(timeI) + ".uns" - ); - - Info<< " file:" << fvFileName.c_str() << endl; - - - std::ofstream fvFile(fvFileName.c_str()); - - //Info<< "Writing header ..." << endl; - - // Output the magic number. - writeInt(fvFile, FV_MAGIC); - - // Output file header and version number. - writeStr80(fvFile, "FIELDVIEW"); - - // This version of the FIELDVIEW unstructured file is "3.0". - // This is written as two integers. - writeInt(fvFile, 3); - writeInt(fvFile, 0); - - - // File type code. Grid and results. - writeInt(fvFile, FV_COMBINED_FILE); - - // Reserved field, always zero - writeInt(fvFile, 0); - - // Output constants for time, fsmach, alpha and re. - float fBuf[4]; - fBuf[0] = runTime.value(); - fBuf[1] = 0.0; - fBuf[2] = 0.0; - fBuf[3] = 1.0; - fvFile.write(reinterpret_cast<char*>(fBuf), 4*sizeof(float)); - - - // Output the number of grids - writeInt(fvFile, 1); - - - // - // Boundary table - // - //Info<< "Writing boundary table ..." << endl; - - // num patches - writeInt(fvFile, mesh.boundary().size()); - - forAll(mesh.boundary(), patchI) - { - const fvPatch& currPatch = mesh.boundary()[patchI]; - - writeInt(fvFile, 1); // data present - writeInt(fvFile, 1); // normals ok - - // name - writeStr80(fvFile, currPatch.name().c_str()); - } - - - // - // Create fields: - // volFieldPtrs : List of ptrs to all volScalar/Vector fields - // (null if field not present at current time) - // volFieldNames : FieldView compatible names of volFields - // surfFieldPtrs : same for surfaceScalar/Vector - // surfFieldNames -# include "createFields.H" - - - - // - // Write Variables table - // - - //Info<< "Writing variables table ..." << endl; - - writeInt(fvFile, volFieldNames.size()); - forAll(volFieldNames, fieldI) - { - if (volFieldPtrs[fieldI] == NULL) - { - Info<< " dummy field for " - << volFieldNames[fieldI].c_str() << endl; - } - - writeStr80(fvFile, volFieldNames[fieldI].c_str()); - } - - // - // Write Boundary Variables table = vol + surface fields - // - - //Info<< "Writing boundary variables table ..." << endl; - - writeInt - ( - fvFile, - volFieldNames.size() + surfFieldNames.size() - ); - forAll(volFieldNames, fieldI) - { - writeStr80(fvFile, volFieldNames[fieldI].c_str()); - } - forAll(surfFieldNames, fieldI) - { - if (surfFieldPtrs[fieldI] == NULL) - { - Info<< " dummy surface field for " - << surfFieldNames[fieldI].c_str() << endl; - } - - writeStr80(fvFile, surfFieldNames[fieldI].c_str()); - } - - - // Output grid data. - - // - // Nodes - // - - //Info<< "Writing points ..." << endl; - - const pointField& points = mesh.points(); - label nPoints = points.size(); - - writeInt(fvFile, FV_NODES); - writeInt(fvFile, nPoints); - - for (direction cmpt=0; cmpt<vector::nComponents; cmpt++) - { - floatField fField(nPoints); - - for (label pointi = 0; pointi<nPoints; pointi++) - { - fField[pointi] = float(points[pointi][cmpt]); - } - - fvFile.write - ( - reinterpret_cast<char*>(fField.begin()), - fField.size()*sizeof(float) - ); - } - - // - // Boundary Faces - regular - // - - //Info<< "Writing regular boundary faces ..." << endl; - - forAll(mesh.boundary(), patchI) - { - label nQuadFaces = topo.quadFaceLabels()[patchI].size()/4; - - if (nQuadFaces != 0) - { - writeInt(fvFile, FV_FACES); - writeInt(fvFile, patchI + 1); // patch number - writeInt(fvFile, nQuadFaces); // number of faces in patch - fvFile.write - ( - reinterpret_cast<const char*> - (topo.quadFaceLabels()[patchI].begin()), - nQuadFaces*4*sizeof(int) - ); - } - } - - // - // Boundary Faces - arbitrary polygon - // - - //Info<< "Write polygonal boundary faces ..." << endl; - - forAll(mesh.boundary(), patchI) - { - if (topo.nPolyFaces()[patchI] > 0) - { - writeInt(fvFile, FV_ARB_POLY_FACES); - writeInt(fvFile, patchI + 1); - - // number of arb faces in patch - writeInt(fvFile, topo.nPolyFaces()[patchI]); - - const polyPatch& patchFaces = mesh.boundary()[patchI].patch(); - - forAll(patchFaces, faceI) - { - const face& f = patchFaces[faceI]; - - if (f.size() > 4) - { - writeInt(fvFile, f.size()); - - forAll(f, fp) - { - writeInt(fvFile, f[fp] + 1); - } - } - } - } - } - - - // - // Write regular topology - // - - //Info<< "Writing regular elements ..." << endl; - - writeInt(fvFile, FV_ELEMENTS); - writeInt(fvFile, topo.nTet()); - writeInt(fvFile, topo.nHex()); - writeInt(fvFile, topo.nPrism()); - writeInt(fvFile, topo.nPyr()); - fvFile.write - ( - reinterpret_cast<const char*>(topo.tetLabels().begin()), - topo.nTet()*(1+4)*sizeof(int) - ); - fvFile.write - ( - reinterpret_cast<const char*>(topo.hexLabels().begin()), - topo.nHex()*(1+8)*sizeof(int) - ); - fvFile.write - ( - reinterpret_cast<const char*>(topo.prismLabels().begin()), - topo.nPrism()*(1+6)*sizeof(int) - ); - fvFile.write - ( - reinterpret_cast<const char*>(topo.pyrLabels().begin()), - topo.nPyr()*(1+5)*sizeof(int) - ); - - - // - // Write arbitrary polyhedra - // - - //Info<< "Writing polyhedral elements ..." << endl; - - - const cellShapeList& cellShapes = mesh.cellShapes(); - const cellModel& unknown = *(cellModeller::lookup("unknown")); - - if (topo.nPoly() > 0) - { - writeInt(fvFile, FV_ARB_POLY_ELEMENTS); - writeInt(fvFile, topo.nPoly()); - - forAll(cellShapes, celli) - { - if (cellShapes[celli].model() == unknown) - { - const cell& cll = mesh.cells()[celli]; - - // number of faces - writeInt(fvFile, cll.size()); - // number of vertices used (no cell centre) - writeInt(fvFile, countVerts(mesh, celli)); - // cell centre node id - writeInt(fvFile, -1); - - forAll(cll, cellFacei) - { - label faceI = cll[cellFacei]; - - const face& f = mesh.faces()[faceI]; - - // Not a wall for now - writeInt(fvFile, NOT_A_WALL); - - writeInt(fvFile, f.size()); - - if (mesh.faceOwner()[faceI] == celli) - { - forAll(f, fp) - { - writeInt(fvFile, f[fp]+1); - } - } - else - { - for (label fp = f.size()-1; fp >= 0; fp--) - { - writeInt(fvFile, f[fp]+1); - } - } - - // Number of hanging nodes - writeInt(fvFile, 0); - } - } - } - } - - - // - // Variables data - // - - //Info<< "Writing variables data ..." << endl; - - volPointInterpolation pInterp(mesh); - - writeInt(fvFile, FV_VARIABLES); - - - forAll(volFieldPtrs, fieldI) - { - if (volFieldPtrs[fieldI] != NULL) - { - const volScalarField& vField = *volFieldPtrs[fieldI]; - - // Interpolate to points - pointScalarField psf(pInterp.interpolate(vField)); - - floatField fField(nPoints); - - for (label pointi = 0; pointi<nPoints; pointi++) - { - fField[pointi] = float(psf[pointi]); - } - - fvFile.write - ( - reinterpret_cast<char*>(fField.begin()), - fField.size()*sizeof(float) - ); - } - else - { - // Create dummy field - floatField dummyField(nPoints, 0.0); - - fvFile.write - ( - reinterpret_cast<char*>(dummyField.begin()), - dummyField.size()*sizeof(float) - ); - } - } - - - // - // Boundary variables data - // 1. volFields - // 2. surfFields - - //Info<< "Writing regular boundary elements data ..." << endl; - - writeInt(fvFile, FV_BNDRY_VARS); - - forAll(volFieldPtrs, fieldI) - { - if (volFieldPtrs[fieldI] != NULL) - { - const volScalarField& vsf = *volFieldPtrs[fieldI]; - - forAll(mesh.boundary(), patchI) - { - writeFaceData - ( - mesh, - topo, - patchI, - vsf.boundaryField()[patchI], - false, - fvFile - ); - } - } - else - { - forAll(mesh.boundaryMesh(), patchI) - { - // Dummy value. - floatField fField - ( - mesh.boundaryMesh()[patchI].size() - - topo.nPolyFaces()[patchI], - 0.0 - ); - - fvFile.write - ( - reinterpret_cast<char*>(fField.begin()), - fField.size()*sizeof(float) - ); - } - } - } - - // surfFields - forAll(surfFieldPtrs, fieldI) - { - if (surfFieldPtrs[fieldI] != NULL) - { - const surfaceScalarField& ssf = *surfFieldPtrs[fieldI]; - - forAll(mesh.boundary(), patchI) - { - writeFaceData - ( - mesh, - topo, - patchI, - ssf.boundaryField()[patchI], - false, - fvFile - ); - } - } - else - { - forAll(mesh.boundaryMesh(), patchI) - { - // Dummy value. - floatField fField - ( - mesh.boundaryMesh()[patchI].size() - - topo.nPolyFaces()[patchI], - 0.0 - ); - - fvFile.write - ( - reinterpret_cast<char*>(fField.begin()), - fField.size()*sizeof(float) - ); - } - } - } - - // - // Polygonal faces boundary data - // 1. volFields - // 2. surfFields - - //Info<< "Writing polygonal boundary elements data ..." << endl; - - writeInt(fvFile, FV_ARB_POLY_BNDRY_VARS); - forAll(volFieldPtrs, fieldI) - { - if (volFieldPtrs[fieldI] != NULL) - { - const volScalarField& vsf = *volFieldPtrs[fieldI]; - - // All non-empty patches - forAll(mesh.boundary(), patchI) - { - writeFaceData - ( - mesh, - topo, - patchI, - vsf.boundaryField()[patchI], - true, - fvFile - ); - } - } - else - { - forAll(mesh.boundary(), patchI) - { - // Dummy value. - floatField fField(topo.nPolyFaces()[patchI], 0.0); - - fvFile.write - ( - reinterpret_cast<char*>(fField.begin()), - fField.size()*sizeof(float) - ); - } - } - } - - // surfFields - forAll(surfFieldPtrs, fieldI) - { - if (surfFieldPtrs[fieldI] != NULL) - { - const surfaceScalarField& ssf = *surfFieldPtrs[fieldI]; - - // All non-empty patches - forAll(mesh.boundary(), patchI) - { - writeFaceData - ( - mesh, - topo, - patchI, - ssf.boundaryField()[patchI], - true, - fvFile - ); - } - } - else - { - forAll(mesh.boundaryMesh(), patchI) - { - // Dummy value. - floatField fField - ( - mesh.boundaryMesh()[patchI].size() - - topo.nPolyFaces()[patchI], - 0.0 - ); - - fvFile.write - ( - reinterpret_cast<char*>(fField.begin()), - fField.size()*sizeof(float) - ); - } - } - } - - - // - // Cleanup volume and surface fields - // - forAll(volFieldPtrs, fieldI) - { - delete volFieldPtrs[fieldI]; - } - forAll(surfFieldPtrs, fieldI) - { - delete surfFieldPtrs[fieldI]; - } - - - - - // - // Spray - // - if (hasLagrangian) - { - // Read/create fields: - // sprayScalarFieldPtrs: List of ptrs to lagrangian scalfields - // sprayVectorFieldPtrs: ,, vec ,, -# include "createSprayFields.H" - - - // Write time header - - // Time index (FieldView: has to start from 1) - writeInt(fvParticleFile, fieldViewTime + 1); - - // Time value - writeFloat(fvParticleFile, runTime.value()); - - // Read particles - Cloud<passiveParticle> parcels(mesh); - - // Num particles - writeInt(fvParticleFile, parcels.size()); - - Info<< " Writing " << parcels.size() << " particles." << endl; - - - // - // Output data parcelwise - // - - label parcelNo = 0; - - - for - ( - Cloud<passiveParticle>::iterator elmnt = parcels.begin(); - elmnt != parcels.end(); - ++elmnt, parcelNo++ - ) - { - writeInt(fvParticleFile, parcelNo+1); - - writeFloat(fvParticleFile, elmnt().position().x()); - writeFloat(fvParticleFile, elmnt().position().y()); - writeFloat(fvParticleFile, elmnt().position().z()); - - forAll(sprayScalarFieldPtrs, fieldI) - { - if (sprayScalarFieldPtrs[fieldI] != NULL) - { - const IOField<scalar>& sprayField = - *sprayScalarFieldPtrs[fieldI]; - writeFloat - ( - fvParticleFile, - sprayField[parcelNo] - ); - } - else - { - writeFloat(fvParticleFile, 0.0); - } - } - forAll(sprayVectorFieldPtrs, fieldI) - { - if (sprayVectorFieldPtrs[fieldI] != NULL) - { - const IOField<vector>& sprayVectorField = - *sprayVectorFieldPtrs[fieldI]; - const vector& val = - sprayVectorField[parcelNo]; - - writeFloat(fvParticleFile, val.x()); - writeFloat(fvParticleFile, val.y()); - writeFloat(fvParticleFile, val.z()); - } - else - { - writeFloat(fvParticleFile, 0.0); - writeFloat(fvParticleFile, 0.0); - writeFloat(fvParticleFile, 0.0); - } - } - } - - // increment fieldView particle time - fieldViewTime++; - - - // - // Cleanup spray fields - // - forAll(sprayScalarFieldPtrs, fieldI) - { - delete sprayScalarFieldPtrs[fieldI]; - } - forAll(sprayVectorFieldPtrs, fieldI) - { - delete sprayVectorFieldPtrs[fieldI]; - } - - } // end of hasLagrangian - } - - if (!hasLagrangian) - { - rm(fvParticleFileName); - } - - Info<< "End\n" << endl; - - return 0; -} - - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/fv_reader_tags.h b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/fv_reader_tags.h deleted file mode 100644 index 6fd11fd5dbb..00000000000 --- a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/fv_reader_tags.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef FV_READER_TAGS_H -#define FV_READER_TAGS_H - -/* Numeric tags (codes) for FIELDVIEW binary file format. */ - -#define FV_MAGIC 0x00010203 /* decimal 66051 */ - -/* Content of the file (grid only, results only or combined). */ -#define FV_GRIDS_FILE 1 -#define FV_RESULTS_FILE 2 -#define FV_COMBINED_FILE 3 - -#define FV_NODES 1001 -#define FV_FACES 1002 -#define FV_ELEMENTS 1003 -#define FV_VARIABLES 1004 -#define FV_BNDRY_VARS 1006 -#define FV_ARB_POLY_FACES 1007 -#define FV_ARB_POLY_ELEMENTS 1008 -#define FV_ARB_POLY_BNDRY_VARS 1009 - -#define FV_TET_ELEM_ID 1 -#define FV_HEX_ELEM_ID 2 -#define FV_PRISM_ELEM_ID 3 -#define FV_PYRA_ELEM_ID 4 -#define FV_ARB_POLY_ELEM_ID 5 - -/* Values for "wall_info" array (see comments in fv_encode_elem_header). */ -#ifdef __STDC__ -#define A_WALL (07u) -#define NOT_A_WALL (0u) -#else -#define A_WALL (07) -#define NOT_A_WALL (0) -#endif - -#endif /* FV_READER_TAGS_H */ diff --git a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/getFieldNames.H b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/getFieldNames.H deleted file mode 100644 index ec540efe7df..00000000000 --- a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/getFieldNames.H +++ /dev/null @@ -1,68 +0,0 @@ -HashSet<word> volScalarHash; -HashSet<word> volVectorHash; -HashSet<word> surfScalarHash; -HashSet<word> surfVectorHash; -HashSet<word> sprayScalarHash; -HashSet<word> sprayVectorHash; - -forAll(timeDirs, timeI) -{ - runTime.setTime(timeDirs[timeI], timeI); - - // Add all fields to hashtable - IOobjectList objects(mesh, runTime.timeName()); - { - wordList fieldNames(objects.names(volScalarField::typeName)); - forAll(fieldNames, fieldI) - { - volScalarHash.insert(fieldNames[fieldI]); - } - } - { - wordList fieldNames(objects.names(volVectorField::typeName)); - forAll(fieldNames, fieldI) - { - volVectorHash.insert(fieldNames[fieldI]); - } - } - { - wordList fieldNames(objects.names(surfaceScalarField::typeName)); - forAll(fieldNames, fieldI) - { - surfScalarHash.insert(fieldNames[fieldI]); - } - } - { - wordList fieldNames(objects.names(surfaceVectorField::typeName)); - forAll(fieldNames, fieldI) - { - surfVectorHash.insert(fieldNames[fieldI]); - } - } - - - // Same for spray - IOobjectList sprayObjects(mesh, runTime.timeName(), cloud::prefix); - { - wordList fieldNames(sprayObjects.names(scalarIOField::typeName)); - forAll(fieldNames, fieldI) - { - sprayScalarHash.insert(fieldNames[fieldI]); - } - } - { - wordList fieldNames(sprayObjects.names(vectorIOField::typeName)); - forAll(fieldNames, fieldI) - { - sprayVectorHash.insert(fieldNames[fieldI]); - } - } -} - - -wordList volScalarNames(volScalarHash.toc()); -wordList volVectorNames(volVectorHash.toc()); -wordList surfScalarNames(surfScalarHash.toc()); -wordList surfVectorNames(surfVectorHash.toc()); -wordList sprayScalarNames(sprayScalarHash.toc()); -wordList sprayVectorNames(sprayVectorHash.toc()); diff --git a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/moveMesh.H b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/moveMesh.H deleted file mode 100644 index 68d0f6f2ccd..00000000000 --- a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/moveMesh.H +++ /dev/null @@ -1,34 +0,0 @@ - -// -// Check if new points (so moving mesh) -// -{ - IOobject pointsHeader - ( - "points", - runTime.timeName(), - polyMesh::defaultRegion, - runTime - ); - if (pointsHeader.headerOk()) - { - // points exists for time step, let's read them - Info<< " Points file detected - updating points" << endl; - - // Reading new points - pointIOField newPoints - ( - IOobject - ( - "points", - runTime.timeName(), - polyMesh::defaultRegion, - mesh, - IOobject::MUST_READ, - IOobject::NO_WRITE - ) - ); - - mesh.polyMesh::movePoints(newPoints); - } -} diff --git a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/writeFunctions.C b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/writeFunctions.C deleted file mode 100644 index e690b45140a..00000000000 --- a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/writeFunctions.C +++ /dev/null @@ -1,97 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#include "writeFunctions.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -// C++ version of fwrite_str80 from FieldView/uns/write_binary_uns.c -// Write padded string of 80 char. -bool writeStr80(std::ostream& os, const string& str) -{ - char cBuf[80]; - - memset(cBuf, '\0', 80); - - int len = str.size(); - - strncpy(cBuf, str.c_str(), (len < 80 ? len : 80)); - - os.write(cBuf, 80*sizeof(char)); - - return os.good(); -} - - -// Write single integer -bool writeInt(std::ostream& os, int val1) -{ - os.write(reinterpret_cast<char*>(&val1), sizeof(int)); - - return os.good(); -} - - -// Write single float -bool writeFloat(std::ostream& os, scalar val1) -{ - float floatVal = val1; - - os.write(reinterpret_cast<char*>(&floatVal), sizeof(float)); - - return os.good(); -} - - -// Debug: write raw bytes -void writeBytes(char* start, int nBytes) -{ - cout.setf(std::ios::hex, std::ios::basefield); - - cout<< start << " : "; - - for (int i = 0; i < nBytes; i++) - { - cout<< " " << start[i]; - } - cout << std::endl; - - cout.setf(std::ios::dec); -} - - -// Debug: write wall flags data -void writeWallFlags(Ostream& os, label cellI, const labelList& wallFlags) -{ - os << "cell " << cellI << " wallsFlags:"; - forAll(wallFlags, wallFaceI) - { - os << wallFlags[wallFaceI] << ' '; - } - os << endl; -} - - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/writeFunctions.H b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/writeFunctions.H deleted file mode 100644 index eb61827d427..00000000000 --- a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/writeFunctions.H +++ /dev/null @@ -1,56 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -InClass - Foam::writeFunctions - -Description - -SourceFiles - writeFunctions.C - -\*---------------------------------------------------------------------------*/ - -#ifndef writeFunctions_H -#define writeFunctions_H - -#include "scalar.H" -#include "string.H" -#include "labelList.H" -#include <iostream> - -using namespace Foam; - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -bool writeStr80(std::ostream& os, const string& str); -bool writeInt(std::ostream& os, int val1); -bool writeFloat(std::ostream& os, scalar val1); -void writeBytes(char* start, int nBytes); -void writeWallFlags(Ostream& os, label cellI, const labelList& wallFlags); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/writeSprayHeader.H b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/writeSprayHeader.H deleted file mode 100644 index 377e1e2c082..00000000000 --- a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/writeSprayHeader.H +++ /dev/null @@ -1,26 +0,0 @@ -{ - /* Output the magic number. */ - writeInt(fvParticleFile, FV_MAGIC); - - /* Output file header and version number. */ - writeStr80(fvParticleFile, "FVPARTICLES"); - - /* version */ - writeInt(fvParticleFile, 1); - writeInt(fvParticleFile, 1); - - int nFields = sprayScalarNames.size() + 3*sprayVectorNames.size(); - writeInt(fvParticleFile, nFields); - - forAll(sprayScalarNames, nameI) - { - writeStr80(fvParticleFile, sprayScalarNames[nameI]); - } - forAll(sprayVectorNames, nameI) - { - const string& name(sprayVectorNames[nameI]); - writeStr80(fvParticleFile, name + ("x;" + name)); - writeStr80(fvParticleFile, name + ("y;" + name)); - writeStr80(fvParticleFile, name + ("z;" + name)); - } -} diff --git a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/write_binary_uns.c b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/write_binary_uns.c deleted file mode 100644 index 6cd3eb6620b..00000000000 --- a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/write_binary_uns.c +++ /dev/null @@ -1,641 +0,0 @@ -/* -** Support functions for writing a combined (grid and results) file -** in the binary FIELDVIEW unstructured format. -*/ - -/* Include system stuff for I/O and string and exit functions. */ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -/* Include the defines for the FV_* codes and wall_info values. */ -#include "fv_reader_tags.h" - - -/* Don't change these - used by fv_encode_elem_header ! */ -#define MAX_NUM_ELEM_FACES 6 -#define BITS_PER_WALL 3 -#define ELEM_TYPE_BIT_SHIFT (MAX_NUM_ELEM_FACES*BITS_PER_WALL) - - -/* -** fv_encode_elem_header: return an encoded binary element header -** -** Input: -** elem_type: integer element type as shown in fv_reader_tags.h -** wall_info: array of integer "wall" flags, one for each face of -** the element. The wall flags are used during streamline -** calculation. Currently, the only meaningful values are -** A_WALL and NOT_A_WALL as shown in fv_reader_tags.h. -** Streamlines are forced away from faces marked as -** "A_WALL", by limiting velocity and position very near -** the wall. -** Output: -** Function return value is the encoded binary element header. -*/ - -#ifdef __STDC__ -unsigned int fv_encode_elem_header (int elem_type, int wall_info[]) -#else -unsigned int fv_encode_elem_header (elem_type, wall_info) -int elem_type; -int wall_info[]; -#endif -{ - unsigned int header; - int i, nfaces; - - switch (elem_type) - { - case FV_TET_ELEM_ID: - header = (1 << ELEM_TYPE_BIT_SHIFT); - nfaces = 4; - break; - case FV_HEX_ELEM_ID: - header = (4 << ELEM_TYPE_BIT_SHIFT); - nfaces = 6; - break; - case FV_PRISM_ELEM_ID: - header = (3 << ELEM_TYPE_BIT_SHIFT); - nfaces = 5; - break; - case FV_PYRA_ELEM_ID: - header = (2 << ELEM_TYPE_BIT_SHIFT); - nfaces = 5; - break; - default: - fprintf(stderr, "ERROR: Unknown element type\n"); - return 0; - } - - for (i = 0; i < nfaces; i++) - { - unsigned int u = wall_info[i]; - if (u > A_WALL) - { - fprintf(stderr, "ERROR: Bad wall value\n"); - return 0; - } - header |= (u << (i*BITS_PER_WALL)); - } - return header; -} - -/* -** fwrite_str80: write out a string padded to 80 characters. -** -** Like fwrite, this returns the number of items written, which -** should be 80 if successful, and less than 80 if it failed. -*/ -#ifdef __STDC__ -size_t fwrite_str80 (char *str, FILE *fp) -#else -int fwrite_str80 (str, fp) -char *str; -FILE *fp; -#endif -{ - char cbuf[80]; - size_t len; - int i; - - /* Most of this just to avoid garbage after the name. */ - len = strlen(str); - strncpy(cbuf, str, len < 80 ? len : 80); - - for (i = len; i < 80; i++) - cbuf[i] = '\0'; /* pad with zeros */ - - return fwrite(cbuf, sizeof(char), 80, fp); -} - - -/* -** Sample program which writes out a single unstructured grid containing -** four hex elements, with pressure and velocity data at the nodes, and -** surface data for temperature and velocity on some of the boundaries. -** -** The data is written as a combined (grid and results) file in the -** binary FIELDVIEW unstructured format. -** -** For simplicity, no error checking is done on the calls to fwrite -** and fwrite_str80. -*/ -#if 0 /***** CHANGE THIS TO "#if 1" TO RUN THE SAMPLE PROGRAM. *****/ -int main() -{ - char *file_name = "quad_hex.uns"; - FILE *outfp; - int num_grids = 1; - int num_face_types = 5; - /* - ** Note that one of the boundary type names is "wall." - ** The boundary name "wall" has no special meaning in FIELDVIEW. - ** Boundary types and element walls are independent pieces of - ** information. The only way to mark an element face as a wall - ** (for streamline calculation) is with the wall_info array passed - ** to fv_encode_elem_header. - */ - static char *face_type_names[5] = { "bottom", "top", "wall", - "trimmed cell", "hanging node cell"}; - /* - ** Each boundary type is flagged with 1 or 0 depending on - ** whether surface results are present or absent (see below). - */ - static int results_flag[5] = { 1, 1, 0, 1, 1 }; - /* - ** Each boundary type is flagged with 1 or 0 depending on - ** whether surface normals can be calculated from a "right - ** hand rule" (see below). - */ - static int normals_flag[5] = { 1, 1, 0, 1, 1 }; - - /* - ** Note that vector variables are specified by a ';' and vector name - ** following the first scalar name of 3 scalar components of the - ** vector. If writing 2-D results, the third component must still - ** be provided here, and its values must be written in the variables - ** section below (typically padded with zeros.) - */ - int num_vars = 4; - static char *var_names[4] = { "pressure", "uvel; velocity", "vvel", "wvel" }; - int num_bvars = 4; - static char *bvar_names[4] = { "temperature", "uvel; velocity", "vvel", "wvel" }; - - unsigned int elem_header; - int grid, i; - int ibuf[10]; - - int nnodes = 31; /* Number of nodes in the grid. */ - const int num_faces_trim_cell = 7; - const int num_faces_hang_cell = 6; - - /* Constants. */ - static float consts[4] = { 1., 0., 0., 0. }; - - /* XYZ coordinates of the nodes. */ - static float x[31] = {-1., -1., 1., 1., -1., -1., 1., 1., -1., -1., 1.,1., 2., 2., 3., 3., 2.5, 3., 2., 3., 3., 2., 2.5, - 3., 3., 3., 2.5, 2., 2., 2.0, 2.5}; - - static float y[31] = {-1., -1., -1., -1., 1., 1., 1., 1., 3., 3., 3., 3., - 0., 0., 0., 0., 0., .5, 1., 1., 1., 1., .5, - 2., 2., 1.5, 2., 2., 2., 1.45, 1.5}; - - static float z[31] = {-1., 1., -1., 1., -1., 1., -1., 1., -1., 1., -1.,1., 1., 0., 0., .5, 1., 1., 1., 1., 0., 0., .5, - 0., 1., 1., 1., 1., 0., 1., 1.}; - - /* hex1 and hex2 are hex elements, defined as an array of node numbers. */ - static int hex1[8] = {1,2,3,4,5,6,7,8}; - static int hex2[8] = {5,6,7,8,9,10,11,12}; - - /* - ** Face definitions for boundary faces. - ** All faces have 4 vertices. If the face is triangular, - ** the last vertex should be zero. - */ - static int bot_faces[4] = { 1,2,4,3 }; - static int top_faces[4] = { 9,10,12,11 }; - static int wall_faces[8][4] = - { {1,2,6,5}, {5,6,10,9}, {3,4,8,7}, {7,8,12,11}, - {1,3,7,5}, {5,7,11,9}, {2,4,8,6}, {6,8,12,10} }; - - /* Arbitrary Polyhedron faces: */ - static int trim_cell_face[num_faces_trim_cell][6] = - { {5,13,14,15,16,17}, {3,16,18,17}, - {5,15,21,20,18,16}, {5,13,17,18,20,19}, - {4,13,19,22,14}, {4,14,22,21,15}, - {4,19,20,21,22} }; - - static int hang_cell_face[num_faces_hang_cell][8] = - { {5,20,21,24,25,26}, - {5,24,29,28,27,25}, - {7,20,26,25,27,28,30,19}, - {4,20,19,22,21}, - {4,21,22,29,24}, - {5,22,19,30,28,29} }; - - /* Wall values for element faces. */ - static int hex1_walls[6] = { A_WALL, A_WALL, NOT_A_WALL, - NOT_A_WALL, A_WALL, A_WALL }; - static int hex2_walls[6] = { A_WALL, A_WALL, NOT_A_WALL, - NOT_A_WALL, A_WALL, A_WALL }; - - /* 4 variables (pressure and velocity values) at the 31 grid nodes. */ - static float vars[4][31] = - { {1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,1.10,1.11, - 1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,1.10,1.11, - 1.12,1.13,1.14,1.15,1.16,1.17,1.18}, - {0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0,1.1,1.2, - 1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,1.10,1.11, - 1.12,1.13,1.14,1.15,1.16,1.17,1.18}, - {1.2,1.1,1.0,0.9,0.8,0.7,0.6,0.5,0.4,0.3,0.2,0.1, - 1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,1.10,1.11, - 1.12,1.13,1.14,1.15,1.16,1.17,1.18}, - {0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0,1.1,1.2, - 1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,1.10,1.11, - 1.12,1.13,1.14,1.15,1.16,1.17,1.18} }; - - /* - ** 4 boundary variables (temperature and velocity values) defined on - ** the single top face, and the the single bottom face. - */ - static float top_bvars[4] = { 1.0, 2.0,4.0,2.5 }; - static float bot_bvars[4] = { 1.0, 4.5,3.0,3.0 }; - - /* Arbitrary Polyhedron boundary face variables: */ - static float trim_cell_bvars[4][num_faces_trim_cell] = - { {1.0,1.1,1.2,1.3,1.4,1.5,1.6}, - {1.7,1.8,1.9,1.1,1.11,1.12,1.13}, - {1.14,1.15,1.16,1.17,1.18,1.19,1.2}, - {1.21,1.22,1.23,1.24,1.25,1.26,1.27} }; - - static float hang_cell_bvars[4][num_faces_hang_cell] = - { {1.1,1.11,1.12,1.13,1.14,1.15}, - {1.16,1.17,1.18,1.19,1.2,1.21}, - {1.22,1.23,1.24,1.25,1.26,1.27}, - {1.28,1.29,1.30,1.31,1.32,1.33} }; - - /* Open the file for binary write access. */ - if ((outfp = fopen(file_name, "wb")) == NULL) - { - perror ("Cannot open output file"); - exit(1); - } - - /* Output the magic number. */ - ibuf[0] = FV_MAGIC; - fwrite(ibuf, sizeof(int), 1, outfp); - - /* Output file header and version number. */ - fwrite_str80("FIELDVIEW", outfp); - - /* - ** This version of the FIELDVIEW unstructured file is "3.0". - ** This is written as two integers. - */ - ibuf[0] = 3; - ibuf[1] = 0; - fwrite(ibuf, sizeof(int), 2, outfp); - - /* File type code - new in version 2.7 */ - ibuf[0] = FV_COMBINED_FILE; - fwrite(ibuf, sizeof(int), 1, outfp); - - /* Reserved field, always write a zero - new in version 2.6 */ - ibuf[0] = 0; - fwrite(ibuf, sizeof(int), 1, outfp); - - /* Output constants for time, fsmach, alpha and re. */ - fwrite(consts, sizeof(float), 4, outfp); - - /* Output the number of grids. */ - ibuf[0] = num_grids; - fwrite(ibuf, sizeof(int), 1, outfp); - - /* - ** Output the table of boundary types. - ** Each boundary type is preceded by 2 integer flags. - ** The first flag is an "surface results flag". - ** A value of 1 means surface results will be present for this - ** boundary type (if any boundary variables are specified in the - ** boundary variable names table below). - ** A value of 0 means no surface results will be present. - ** The second flag indicates whether boundary faces of this type have - ** consistent "clockness" for the purpose of calculating a surface - ** normal. A value of 1 means that all faces of this type are - ** written following a "right hand rule" for clockness. In other - ** words, if the vertices are written on counter-clockwise: - ** 4 --- 3 - ** | | - ** 1 --- 2 - ** then the normal to the face is pointing towards you (not away - ** from you). A value of 0 means that the faces do not have any - ** consistent clockness. The "clockness" of surface normals is - ** only used for calculating certain special surface integrals - ** that involve surface normals. If the surface normals flag - ** is 0, these special integrals will not be available. - */ - ibuf[0] = num_face_types; - fwrite(ibuf, sizeof(int), 1, outfp); - for (i = 0; i < num_face_types; i++) { - ibuf[0] = results_flag[i]; - ibuf[1] = normals_flag[i]; - fwrite(ibuf, sizeof(int), 2, outfp); - fwrite_str80(face_type_names[i], outfp); - } - - /* Output the table of variable names. */ - /* The number of variables can be zero. */ - ibuf[0] = num_vars; - fwrite(ibuf, sizeof(int), 1, outfp); - for (i = 0; i < num_vars; i++) - fwrite_str80(var_names[i], outfp); - - /* - ** Output the table of boundary variable names. - ** Boundary variables are associated with boundary faces, rather than - ** with grid nodes. - ** FIELDVIEW will automatically append "[BNDRY]" to each name - ** so boundary variables can be easily distinguished from ordinary - ** (grid node) variables. - ** The number of boundary variables can be different from the number - ** of ordinary variables. The number of boundary variables can be - ** zero. - */ - ibuf[0] = num_bvars; - fwrite(ibuf, sizeof(int), 1, outfp); - for (i = 0; i < num_bvars; i++) - fwrite_str80(bvar_names[i], outfp); - - /* Output grid data. */ - for (grid = 0; grid < num_grids; grid++) - { - /* Output the node definition section for this grid. */ - ibuf[0] = FV_NODES; - ibuf[1] = nnodes; - fwrite(ibuf, sizeof(int), 2, outfp); - - /* - ** Output the X, then Y, then Z node coordinates. - ** Note that all of the X coordinates are output before any of - ** the Y coordinates. - */ - fwrite(x, sizeof(float), nnodes, outfp); - fwrite(y, sizeof(float), nnodes, outfp); - fwrite(z, sizeof(float), nnodes, outfp); - - /* - ** Output boundary faces of the 3 different types. - ** All faces have 4 vertices. If the face is triangular, - ** the last vertex should be zero. - ** TIP: A single boundary type can be broken into several sections - ** if you prefer. Also, boundary face sections do not have to - ** be in order. You may have a section of 10 faces of type 3, - ** followed by a section of 20 faces of type 2, followed by a - ** section of 15 more faces of type 3. Breaking a boundary - ** type into very many short sections is less efficient. The - ** boundaries will require more memory and be somewhat - ** slower to calculate in FIELDVIEW. - ** - */ - ibuf[0] = FV_FACES; - ibuf[1] = 1; /* first boundary type */ - ibuf[2] = 1; /* number of faces of this type */ - fwrite(ibuf, sizeof(int), 3, outfp); - fwrite(bot_faces, sizeof(int), 4, outfp); - - ibuf[0] = FV_FACES; - ibuf[1] = 2; /* second boundary type */ - ibuf[2] = 1; /* number of faces of this type */ - fwrite(ibuf, sizeof(int), 3, outfp); - fwrite(top_faces, sizeof(int), 4, outfp); - - ibuf[0] = FV_FACES; - ibuf[1] = 3; /* third boundary type */ - ibuf[2] = 8; /* number of faces of this type */ - fwrite(ibuf, sizeof(int), 3, outfp); - fwrite(wall_faces, sizeof(int), 8*4, outfp); - - /* Arbitrary Polygon boundary faces: - ** The format (in psuedocode) is as follows: - ** >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> - ** FV_ARB_POLY_FACES (section header) - ** BndryFaceType NumBndryFaces - ** - ** [for N = 1, NumBndryFaces] - ** NumVertsFaceN Vert1 Vert2 ... Vert{NumVertsFaceN} - ** - ** <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< - ** * The above block should be repeated for different boundary face - ** types, as is the case for standard boundary faces. - ** * These blocks should be after the blocks for standard faces, - ** within the FIELDVIEW-Uns file. - ** * The node ordering for specifying faces should follow a - ** right-handed rule with the normal pointing away from the - ** cell center. So nodes should be given by traversing the face - ** in a counter-clockwise manner. - ** * Hanging nodes are not permitted on boundary faces. - */ - - ibuf[0] = FV_ARB_POLY_FACES; - ibuf[1] = 4; /* boundary face type */ - ibuf[2] = 7; /* num faces for the trimmed cell */ - - fwrite(ibuf, sizeof(int), 3, outfp); - - for (i = 0; i < num_faces_trim_cell; ++i) /* loop over the faces */ - fwrite(trim_cell_face[i], sizeof(int), trim_cell_face[i][0] + 1, - outfp); - - ibuf[0] = FV_ARB_POLY_FACES; - ibuf[1] = 5; /* boundary face type */ - ibuf[2] = 6; /* num faces for the hanging node cell */ - - fwrite(ibuf, sizeof(int), 3, outfp); - - for (i = 0; i < num_faces_hang_cell; ++i) /* loop over the faces */ - fwrite(hang_cell_face[i], sizeof(int), hang_cell_face[i][0] + 1, - outfp); - - /* - ** Start an elements section. - ** There may be as many elements sections as needed. - ** Each section may contain a single element type or a - ** mixture of element types. - ** For maximum efficiency, each section should contain - ** a significant percentage of the elements in the grid. - ** The most efficient case is a single section containing - ** all elements in the grid. - */ - ibuf[0] = FV_ELEMENTS; - ibuf[1] = 0; /* tet count */ - ibuf[2] = 2; /* hex count */ - ibuf[3] = 0; /* prism count */ - ibuf[4] = 0; /* pyramid count */ - fwrite(ibuf, sizeof(int), 5, outfp); - - /* Write header for first element. */ - elem_header = fv_encode_elem_header(FV_HEX_ELEM_ID, hex1_walls); - if (elem_header == 0) - { - fprintf (stderr, "fv_encode_elem_header failed for first hex.\n"); - exit(1); - } - fwrite (&elem_header, sizeof(elem_header), 1, outfp); - - /* Write node definition for first element. */ - fwrite(hex1, sizeof(int), 8, outfp); - - /* Write header for second element. */ - elem_header = fv_encode_elem_header(FV_HEX_ELEM_ID, hex2_walls); - if (elem_header == 0) - { - fprintf (stderr, "fv_encode_elem_header failed for second hex.\n"); - exit(1); - } - fwrite (&elem_header, sizeof(elem_header), 1, outfp); - - /* Write node definition for second element. */ - fwrite(hex2, sizeof(int), 8, outfp); - - /* Arbitrary Polyhedron elements: - ** The format (in psuedocode) is as follows: - ** >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> - ** FV_ARB_POLY_ELEMENTS (section header) - ** NumArbPolyElements - ** - ** [for elem = 1, NumArbPolyElements] - ** { - ** NumFaces NumNodesElement CenterNode - ** - ** [for face = 1, NumFaces] - ** WallFlag NumNodesFace FaceNode1 ... FaceNode{NumNodesFace} - ** NumHangNodes HangNode1 ... HangNode{NumHangNodes} - ** } - ** <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< - ** * These blocks can be after or before the standard element blocks. - ** There can be any number of these for any one grid. - ** * The WallFlag has the same meaning as for standard elements, - ** i.e., A_WALL or NOT_A_WALL. - ** * The node ordering for specifying faces should follow a - ** right-handed rule with the normal pointing away from the - ** cell center. So nodes should be given by traversing the face - ** in a counter-clockwise manner. - ** * Hanging nodes are associated with a face interior and should - ** not be on an edge. Hanging nodes on an edge should be - ** interpretted as a regular face node. - */ - ibuf[0] = FV_ARB_POLY_ELEMENTS; - ibuf[1] = 2; /* have 2 elements here */ - - fwrite(ibuf, sizeof(int), 2, outfp); - - /* trimmed face element */ - ibuf[0] = 7; /* num faces for the trimmed cell */ - ibuf[1] = 11; /* number of nodes including a center node */ - ibuf[2] = 23; /* the center node */ - fwrite(ibuf, sizeof(int), 3, outfp); - - ibuf[0] = A_WALL; /* wall value */ - ibuf[1] = 0; /* number of hanging nodes */ - - for (i = 0; i < num_faces_trim_cell; ++i) /* write out face info */ - { - fwrite(ibuf, sizeof(int), 1, outfp); /* write wall value */ - fwrite(trim_cell_face[i], sizeof(int), trim_cell_face[i][0] + 1, - outfp); /* write num verts and verts */ - fwrite(&ibuf[1], sizeof(int), 1, outfp); /* write num hang nodes */ - } - - /* hanging node element */ - ibuf[0] = 6; /* num faces for the hanging node cell */ - ibuf[1] = 12; /* number of nodes excluding a center node */ - ibuf[2] = -1; /* the center node, this indicates that FIELDVIEW - ** should calculate the center node and associated - ** centernode variable values - */ - fwrite(ibuf, sizeof(int), 3, outfp); - - ibuf[0] = A_WALL; /* wall value */ - ibuf[1] = 0; /* number of hanging nodes */ - ibuf[2] = 1; /* number of hanging nodes for face 3 */ - ibuf[3] = 31; /* the node number for the hanging node on face 3*/ - - for (i = 0; i < 2; ++i) /* write out face info for first 2 faces */ - { - fwrite(ibuf, sizeof(int), 1, outfp); /* write wall value */ - fwrite(hang_cell_face[i], sizeof(int), hang_cell_face[i][0] + 1, - outfp); /* write num verts and verts */ - fwrite(&ibuf[1], sizeof(int), 1, outfp); /* write num hang nodes */ - } - - /* this face has a hanging node */ - fwrite(ibuf, sizeof(int), 1, outfp); - fwrite(hang_cell_face[2], sizeof(int), hang_cell_face[2][0] + 1, outfp); - fwrite(&ibuf[2], sizeof(int), 2, outfp); - - /* write out face info for last 3 faces */ - for (i = 3; i < num_faces_hang_cell; ++i) - { - fwrite(ibuf, sizeof(int), 1, outfp); /* write wall value */ - fwrite(hang_cell_face[i], sizeof(int), hang_cell_face[i][0] + 1, - outfp); /* write num verts and verts */ - fwrite(&ibuf[1], sizeof(int), 1, outfp); /* write num hang nodes */ - } - - /* - ** Output the variables data. - ** You must write the section header even if the number - ** of variables is zero. - */ - ibuf[0] = FV_VARIABLES; - fwrite(ibuf, sizeof(int), 1, outfp); - - /* - ** Note that all of the data for the first variable is output - ** before any of the data for the second variable. - */ - for (i = 0; i < num_vars; i++) - fwrite(vars[i], sizeof(float), nnodes, outfp); - - /* - ** Output the boundary variables data. - ** Remember that the Boundary Table above has a "surface results - ** flag" indicating which boundary types have surface results. - ** The data should be written in the same order as the faces in - ** the Boundary Faces section, skipping over faces whose boundary - ** type has a surface results flag of zero (false). - ** For each variable, you should write one number per boundary face. - ** You must write the section header even if the number of boundary - ** variables is zero. - */ - ibuf[0] = FV_BNDRY_VARS; - fwrite(ibuf, sizeof(int), 1, outfp); - - /* - ** Note that all of the data for the first variable is output - ** before any of the data for the second variable. - */ - for (i = 0; i < num_bvars; i++) { - int num_faces; - /* - ** The data for the bottom face is written first for each - ** variable, because the bottom face was written first in the - ** "Boundary Faces" section. - ** The "wall" faces are skipped, because the surface results - ** flag for the wall boundary type was 0 (false) in the - ** Boundary Table section. - */ - num_faces = 1; /* number of bottom faces */ - fwrite(&bot_bvars[i], sizeof(float), num_faces, outfp); - num_faces = 1; /* number of top faces */ - fwrite(&top_bvars[i], sizeof(float), num_faces, outfp); - } - - /* Arbitrary Polyhedron boundary face results: - ** The format is the same as for standard boundary face results. - */ - ibuf[0] = FV_ARB_POLY_BNDRY_VARS; - fwrite(ibuf, sizeof(int), 1, outfp); - - for (i = 0; i < num_bvars; ++i) - { - int num_faces; - - num_faces = 7; /* num faces for the trimmed cell */ - fwrite(trim_cell_bvars[i], sizeof(float), num_faces, outfp); - - num_faces = 6; /* num faces for the hanging node cell */ - fwrite(hang_cell_bvars[i], sizeof(float), num_faces, outfp); - } - } - - if (fclose(outfp) != 0) - { - perror ("Cannot close output file"); - exit(1); - } - - return 0; -} -#endif /* end commenting out the sample program */ diff --git a/applications/utilities/postProcessing/graphics/fieldview9Reader/Allwmake b/applications/utilities/postProcessing/graphics/fieldview9Reader/Allwmake deleted file mode 100755 index e4825541df7..00000000000 --- a/applications/utilities/postProcessing/graphics/fieldview9Reader/Allwmake +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -# disabled - -# if [ "$FV_HOME" -a -r $FV_HOME ] -# then -# wmake fieldview9Reader -# fi - -# ----------------------------------------------------------------- end-of-file diff --git a/applications/utilities/postProcessing/graphics/fieldview9Reader/Make/files b/applications/utilities/postProcessing/graphics/fieldview9Reader/Make/files deleted file mode 100644 index 2b7c03bf805..00000000000 --- a/applications/utilities/postProcessing/graphics/fieldview9Reader/Make/files +++ /dev/null @@ -1,5 +0,0 @@ -errno.c -readerDatabase.C -fieldview9Reader.C - -EXE = $(FOAM_APPBIN)/fvbinFoam diff --git a/applications/utilities/postProcessing/graphics/fieldview9Reader/Make/options b/applications/utilities/postProcessing/graphics/fieldview9Reader/Make/options deleted file mode 100644 index 1303d319afc..00000000000 --- a/applications/utilities/postProcessing/graphics/fieldview9Reader/Make/options +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Note: compilation options takes from ld_fv script from Fieldview9. - * Only Linux tested. - * - */ - -#if defined(linux) || defined(linux64) - - FV_LIBS = \ - $(FV_HOME)/user/obj/linux_x86/fv.o \ - -lGL -lGLU -lXmu -lXp -lXt $(XLIBS) -ldl - -#elif defined(solaris) || defined(solarisGcc) - - FV_LIBS = \ - $(FV_HOME)/user/obj/solaris/fv.o \ - -i \ - -L/usr/dt/lib -R/usr/dt/lib -lMrm -lXm \ - -L/opt/SUNWits/Graphics-sw/xgl-3.0/lib \ - -R/opt/SUNWits/Graphics-sw/xgl-3.0/lib -lxgl \ - -L/usr/openwin/lib -R/usr/openwin/lib \ - -L$(FV_HOME)/user/obj/solaris \ - -lGL -lGLU -lXt $(XLIBS) \ - -lgen -lnsl -lsocket -lw -lintl -ldl - -#elif defined(sgiN32) || defined(sgiN32Gcc) - - FV_LIBS = \ - $(FV_HOME)/user/obj/iris/fv.o \ - $(FV_HOME)/user/obj/iris/fv2.o \ - $(FV_HOME)/user/obj/iris/fv3.o \ - $(FV_HOME)/user/obj/iris/netserver.o \ - $(FV_HOME)/user/obj/iris/pV_Server.o \ - $(FV_HOME)/user/obj/iris/dore.o \ - $(FV_HOME)/user/obj/iris/libpV3ser.a \ - $(FV_HOME)/user/obj/iris/libgpvm3.a \ - $(FV_HOME)/user/obj/iris/libpvm3.a \ - $(FV_HOME)/user/obj/iris/libBLT.a \ - $(FV_HOME)/user/obj/iris/libtk8.2.a \ - $(FV_HOME)/user/obj/iris/libtcl8.2.a \ - -lGL -lGLU -lgl \ - -lMrm -lXm -lXt $(XLIBS) -lPW \ - -lftn -lc - -#elif defined(sgi64) || defined(sgi64Gcc) - - FV_LIBS = \ - $(FV_HOME)/user/obj/iris64/fv.o \ - $(FV_HOME)/user/obj/iris64/fv2.o \ - $(FV_HOME)/user/obj/iris64/fv3.o \ - $(FV_HOME)/user/obj/iris64/netserver.o \ - $(FV_HOME)/user/obj/iris64/pV_Server.o \ - $(FV_HOME)/user/obj/iris64/dore.o \ - $(FV_HOME)/user/obj/iris64/libpV3ser.a \ - $(FV_HOME)/user/obj/iris64/libgpvm3.a \ - $(FV_HOME)/user/obj/iris64/libpvm3.a \ - $(FV_HOME)/user/obj/iris64/libBLT.a \ - $(FV_HOME)/user/obj/iris64/libtk8.2.a \ - $(FV_HOME)/user/obj/iris64/libtcl8.2.a \ - -lGL -lGLU \ - -lMrm -lXm -lXt $(XLIBS) -lPW \ - -lftn -lc - -#elif defined(ibm) || defined(ibmGcc) - - FV_LIBS = \ - -bh:4 -T512 -H512 \ - -bmaxdata:0x60000000 \ - $(FV_HOME)/user/obj/ibm_rs/fv.o \ - -L/usr/lib -L$(FV_HOME)/user/obj/ibm_rs \ - -lMrm -lXm -lXt -lX11 -lxlf90 \ - -lGL -lGLU -lXext \ - -lm -lc -lPW -lIM -lgl - -#elif defined(hpux) - - FV_LIBS = \ - $(FV_HOME)/user/obj/hp_700/fv.o \ - -L/opt/graphics/common/lib \ - -L/usr/lib/Motif1.2 \ - -L/opt/graphics/OpenGL/lib \ - -L$(FV_HOME)/user/obj/hp_700 \ - -lGL -lGLU -lXext \ - -lXwindow -lhpgfx \ - -lXhp11 -lMrm -lXm -lXt -lX11 \ - -lM -lc -lPW -ldld -ldce $endlib \ - -Wl,+b: -Wl,+s - -#endif - - -EXE_INC = \ - -I$(FV_HOME)/uns \ - -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/browser/lnInclude \ - -I$(LIB_SRC)/lagrangian/basic/lnInclude - -EXE_LIBS = \ - $(FV_LIBS) \ - -lfiniteVolume \ - -lgenericPatchFields \ - -lmeshTools diff --git a/applications/utilities/postProcessing/graphics/fieldview9Reader/README b/applications/utilities/postProcessing/graphics/fieldview9Reader/README deleted file mode 100644 index a70ed87df7e..00000000000 --- a/applications/utilities/postProcessing/graphics/fieldview9Reader/README +++ /dev/null @@ -1,56 +0,0 @@ -Fieldview9 reader module ------------------------- -This is a version of the fvbin executable with a built-in reader for Foam -data. - -1] Limitations --------------- -- only volScalarFields and volVectorFields and only on points, not on boundary. -- handles polyhedra by decomposition (introduces cell centre) -- no surface fields, no lagrangian fields, no tetFem fields. -- does not run in parallel - -2] Building ------------ -It has only been tested on Linux. Other platforms should build with a little -bit of effort. Have a look at the Fieldview link script and see which options -you need to add to Make/options to make it build. - -Instructions: -0. Make sure FV_HOME is set to the root of the FieldView installation. -(i.e. $FV_HOME/user should exist) - -1. Add $FV_HOME/bin to your path and make sure you can actually run fv. - -2. Make the new fv executable by typing - - wmake - - This should create an 'fvbinFoam' executable. - -3. On Linux you can directly run this executable instead of through the 'fv' -script. On other machines you might have to backup the old $FV_HOME/bin/fvbin -executable and move the fvbinFoam one into its position. Now you can use the -fv script to start it all up. - - -3] Running ----------- -After starting it up (see step above) you should have a 'Foam Reader' under -the 'Data Files' pull-down menu. This will open a file selection box. Go to the -case directory and click on any file. The reader will recognize that the -current directory is a case directory (it has checks for a 'constant' directory) -and start reading the mesh. It will -pop-up a box with time steps and a list of variables as usual. - -In case of a case with topology changes (i.e. more than one mesh) it -will ask for the time step a second time. This is due to a limitation in -Fieldview. Choose the same time as before. - -In the terminal window it will print various informational messages. - -A not fairly well tested feature is cellSet displaying. Instead of selecting -a case directory selecting a cellSet (in a polyMesh/sets/ directory) it -will try to subset the mesh using the selected cellSet. It is not possible -to display fields on subsetted meshes. - diff --git a/applications/utilities/postProcessing/graphics/fieldview9Reader/errno.c b/applications/utilities/postProcessing/graphics/fieldview9Reader/errno.c deleted file mode 100644 index 8330a8fd147..00000000000 --- a/applications/utilities/postProcessing/graphics/fieldview9Reader/errno.c +++ /dev/null @@ -1 +0,0 @@ -int errno = 0; diff --git a/applications/utilities/postProcessing/graphics/fieldview9Reader/fieldview9Reader.C b/applications/utilities/postProcessing/graphics/fieldview9Reader/fieldview9Reader.C deleted file mode 100644 index 301f2e66f72..00000000000 --- a/applications/utilities/postProcessing/graphics/fieldview9Reader/fieldview9Reader.C +++ /dev/null @@ -1,1209 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -Description - Reader module for Fieldview9 to read OpenFOAM mesh and data. - - Creates new 'fvbin' type executable which needs to be installed in place - of bin/fvbin. - - Implements a reader for combined mesh&results on an unstructured mesh. - - See Fieldview Release 9 Reference Manual and coding in user/ directory - of the Fieldview release. - -\*---------------------------------------------------------------------------*/ - -#include "fvCFD.H" -#include "IOobjectList.H" -#include "GeometricField.H" -#include "pointFields.H" -#include "volPointInterpolation.H" -#include "readerDatabase.H" -#include "wallPolyPatch.H" -#include "ListOps.H" -#include "cellModeller.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -extern "C" -{ -// Define various Fieldview constants and prototypes - -#include "fv_reader_tags.h" - -static const int FVHEX = 2; -static const int FVPRISM = 3; -static const int FVPYRAMID = 4; -static const int FVTET = 1; -static const int ITYPE = 1; - -unsigned int fv_encode_elem_header(int elem_type, int wall_info[]); -void time_step_get_value(float*, int, int*, float*, int*); -void fv_error_msg(const char*, const char*); - -void reg_single_unstruct_reader -( - char *, - void - ( - char*, int*, int*, int*, int*, int*, int*, - int[], int*, char[][80], int[], int*, char[][80], int* - ), - void - ( - int*, int*, int*, float[], int*, float[], int* - ) -); - -int create_tet(const int, const int[8], const int[]); -int create_pyramid(const int, const int[8], const int[]); -int create_prism(const int, const int[8], const int[]); -int create_hex(const int, const int[8], const int[]); - -typedef unsigned char uChar; -extern uChar create_bndry_face_buffered -( - int bndry_type, - int num_verts, - int verts[], - int *normals_flags, - int num_grid_nodes -); - -/* - * just define empty readers here for ease of linking. - * Comment out if you have doubly defined linking error on this symbol - */ -void ftn_register_data_readers() -{} - -/* - * just define empty readers here for ease of linking. - * Comment out if you have doubly defined linking error on this symbol - */ -void ftn_register_functions() -{} - -/* - * just define empty readers here for ease of linking. - * Comment out if you have doubly defined linking error on this symbol - */ -void register_functions() -{} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - - -// -// Storage for all OpenFOAM state (mainly database & mesh) -// -static readerDatabase db_; - - -// Write fv error message. -static void errorMsg(const string& msg) -{ - fv_error_msg("Foam Reader", msg.c_str()); -} - - -// Simple check if directory is valid case directory. -static bool validCase(const fileName& rootAndCase) -{ - //if (isDir(rootAndCase/"system") && isDir(rootAndCase/"constant")) - if (isDir(rootAndCase/"constant")) - { - return true; - } - else - { - return false; - } -} - - -// Check whether case has topo changes by looking back from last time -// to first directory with polyMesh/cells. -static bool hasTopoChange(const instantList& times) -{ - label lastIndex = times.size()-1; - - const Time& runTime = db_.runTime(); - - // Only set time; do not update mesh. - runTime.setTime(times[lastIndex], lastIndex); - - fileName facesInst(runTime.findInstance(polyMesh::meshSubDir, "faces")); - - // See if cellInst is constant directory. Note extra .name() is for - // parallel cases when runTime.constant is '../constant' - if (facesInst != runTime.constant().name()) - { - Info<< "Found cells file in " << facesInst << " so case has " - << "topological changes" << endl; - - return true; - } - else - { - Info<< "Found cells file in " << facesInst << " so case has " - << "no topological changes" << endl; - - return false; - } -} - - -static bool selectTime(const instantList& times, int* iret) -{ - List<float> fvTimes(2*times.size()); - - forAll(times, timeI) - { - fvTimes[2*timeI] = float(timeI); - fvTimes[2*timeI+1] = float(times[timeI].value()); - } - - int istep; - - float time; - - *iret=0; - - time_step_get_value(fvTimes.begin(), times.size(), &istep, &time, iret); - - if (*iret == -5) - { - errorMsg("Out of memory."); - - return false; - } - if (*iret == -15) - { - // Cancel action. - return false; - } - if (*iret != 0) - { - errorMsg("Unspecified error."); - - return false; - } - Info<< "Selected timeStep:" << istep << " time:" << scalar(time) << endl; - - // Set time and load mesh. - db_.setTime(times[istep], istep); - - return true; -} - - -// Gets (names of) all fields in all timesteps. -static void createFieldNames -( - const Time& runTime, - const instantList& Times, - const word& setName -) -{ - // From foamToFieldView9/getFieldNames.H: - - HashSet<word> volScalarHash; - HashSet<word> volVectorHash; - HashSet<word> surfScalarHash; - HashSet<word> surfVectorHash; - - if (setName.empty()) - { - forAll(Times, timeI) - { - const word& timeName = Times[timeI].name(); - - // Add all fields to hashtable - IOobjectList objects(runTime, timeName); - - wordList vsNames(objects.names(volScalarField::typeName)); - - forAll(vsNames, fieldI) - { - volScalarHash.insert(vsNames[fieldI]); - } - - wordList vvNames(objects.names(volVectorField::typeName)); - - forAll(vvNames, fieldI) - { - volVectorHash.insert(vvNames[fieldI]); - } - } - } - db_.setFieldNames(volScalarHash.toc(), volVectorHash.toc()); -} - - -// Appends interpolated values of fieldName to vars array. -static void storeScalarField -( - const volPointInterpolation& pInterp, - const word& fieldName, - float vars[], - label& pointI -) -{ - label nPoints = db_.mesh().nPoints(); - label nTotPoints = nPoints + db_.polys().size(); - - // Check if present - IOobject ioHeader - ( - fieldName, - db_.runTime().timeName(), - db_.runTime(), - IOobject::MUST_READ, - IOobject::NO_WRITE - ); - - if (ioHeader.headerOk()) - { - Info<< "Storing " << nTotPoints << " of interpolated " << fieldName - << endl; - - volScalarField field(ioHeader, db_.mesh()); - - pointScalarField psf(pInterp.interpolate(field)); - - forAll(psf, i) - { - vars[pointI++] = float(psf[i]); - } - - const labelList& polys = db_.polys(); - - forAll(polys, i) - { - label cellI = polys[i]; - - vars[pointI++] = float(field[cellI]); - } - } - else - { - Info<< "Storing " << nTotPoints << " of dummy values of " << fieldName - << endl; - - for (label i = 0; i < nPoints; i++) - { - vars[pointI++] = 0.0; - } - - const labelList& polys = db_.polys(); - - forAll(polys, i) - { - vars[pointI++] = 0.0; - } - } -} - - -// Appends interpolated values of fieldName to vars array. -static void storeVectorField -( - const volPointInterpolation& pInterp, - const word& fieldName, - float vars[], - label& pointI -) -{ - label nPoints = db_.mesh().nPoints(); - - label nTotPoints = nPoints + db_.polys().size(); - - // Check if present - IOobject ioHeader - ( - fieldName, - db_.runTime().timeName(), - db_.runTime(), - IOobject::MUST_READ, - IOobject::NO_WRITE - ); - - if (ioHeader.headerOk()) - { - Info<< "Storing " << nTotPoints << " of interpolated " << fieldName - << endl; - - volVectorField field(ioHeader, db_.mesh()); - - for (direction d = 0; d < vector::nComponents; d++) - { - tmp<volScalarField> tcomp = field.component(d); - const volScalarField& comp = tcomp(); - - pointScalarField psf(pInterp.interpolate(comp)); - - forAll(psf, i) - { - vars[pointI++] = float(psf[i]); - } - - const labelList& polys = db_.polys(); - - forAll(polys, i) - { - label cellI = polys[i]; - - vars[pointI++] = float(comp[cellI]); - } - } - } - else - { - Info<< "Storing " << nTotPoints << " of dummy values of " << fieldName - << endl; - - for (direction d = 0; d < vector::nComponents; d++) - { - for (label i = 0; i < nPoints; i++) - { - vars[pointI++] = 0.0; - } - - const labelList& polys = db_.polys(); - - forAll(polys, i) - { - vars[pointI++] = 0.0; - } - } - } -} - - -// Returns Fieldview face_type of mesh face faceI. -static label getFvType(const polyMesh& mesh, const label faceI) -{ - return mesh.boundaryMesh().whichPatch(faceI) + 1; -} - - -// Returns Fieldview face_type of face f. -static label getFaceType -( - const polyMesh& mesh, - const labelList& faceLabels, - const face& f -) -{ - // Search in subset faceLabels of faces for index of face f. - const faceList& faces = mesh.faces(); - - forAll(faceLabels, i) - { - label faceI = faceLabels[i]; - - if (f == faces[faceI]) - { - // Convert patch to Fieldview face_type. - return getFvType(mesh, faceI); - } - } - - FatalErrorIn("getFaceType") - << "Cannot find face " << f << " in mesh face subset " << faceLabels - << abort(FatalError); - - return -1; -} - - -// Returns Fieldview face_types for set of faces -static labelList getFaceTypes -( - const polyMesh& mesh, - const labelList& cellFaces, - const faceList& cellShapeFaces -) -{ - labelList faceLabels(cellShapeFaces.size()); - - forAll(cellShapeFaces, i) - { - faceLabels[i] = getFaceType(mesh, cellFaces, cellShapeFaces[i]); - } - return faceLabels; -} - - -/* - * Callback for querying file contents. Taken from user/user_unstruct_combined.f - */ -void user_query_file_function -( - /* input */ - char* fname, /* filename */ - int* lenf, /* length of fName */ - int* iunit, /* fortran unit to use */ - int* max_grids, /* maximum number of grids allowed */ - int* max_face_types,/* maximum number of face types allowed */ - int* max_vars, /* maximum number of result variables allowed per */ - /* grid point*/ - - /* output */ - int* num_grids, /* number of grids that will be read from data file */ - int num_nodes[], /* (array of node counts for all grids) */ - int* num_face_types, /* number of special face types */ - char face_type_names[][80], /* array of face-type names */ - int wall_flags[], /* array of flags for the "wall" behavior */ - int* num_vars, /* number of result variables per grid point */ - char var_names[][80], /* array of variable names */ - int* iret /* return value */ -) -{ - fprintf(stderr, "\n** user_query_file_function\n"); - - string rootAndCaseString(fname, *lenf); - - fileName rootAndCase(rootAndCaseString); - - word setName(""); - - if (!validCase(rootAndCase)) - { - setName = rootAndCase.name(); - - rootAndCase = rootAndCase.path(); - - word setDir = rootAndCase.name(); - - rootAndCase = rootAndCase.path(); - - word meshDir = rootAndCase.name(); - - rootAndCase = rootAndCase.path(); - rootAndCase = rootAndCase.path(); - - if - ( - setDir == "sets" - && meshDir == polyMesh::typeName - && validCase(rootAndCase) - ) - { - // Valid set (hopefully - cannot check contents of setName yet). - } - else - { - errorMsg - ( - "Could not find system/ and constant/ directory in\n" - + rootAndCase - + "\nPlease select an OpenFOAM case directory." - ); - - *iret = 1; - - return; - } - - } - - fileName rootDir(rootAndCase.path()); - - fileName caseName(rootAndCase.name()); - - // handle trailing '/' - if (caseName.empty()) - { - caseName = rootDir.name(); - rootDir = rootDir.path(); - } - - Info<< "rootDir : " << rootDir << endl - << "caseName : " << caseName << endl - << "setName : " << setName << endl; - - // - // Get/reuse database and mesh - // - - bool caseChanged = db_.setRunTime(rootDir, caseName, setName); - - - // - // Select time - // - - instantList Times = db_.runTime().times(); - - // If topo case set database time and update mesh. - if (hasTopoChange(Times)) - { - if (!selectTime(Times, iret)) - { - return; - } - } - else if (caseChanged) - { - // Load mesh (if case changed) to make sure we have nPoints etc. - db_.loadMesh(); - } - - - // - // Set output variables - // - - *num_grids = 1; - - const fvMesh& mesh = db_.mesh(); - - label nTotPoints = mesh.nPoints() + db_.polys().size(); - - num_nodes[0] = nTotPoints; - - Info<< "setting num_nodes:" << num_nodes[0] << endl; - - Info<< "setting num_face_types:" << mesh.boundary().size() << endl; - - *num_face_types = mesh.boundary().size(); - - if (*num_face_types > *max_face_types) - { - errorMsg("Too many patches. FieldView limit:" + name(*max_face_types)); - - *iret = 1; - - return; - } - - - forAll(mesh.boundaryMesh(), patchI) - { - const polyPatch& patch = mesh.boundaryMesh()[patchI]; - - strcpy(face_type_names[patchI], patch.name().c_str()); - - if (isA<wallPolyPatch>(patch)) - { - wall_flags[patchI] = 1; - } - else - { - wall_flags[patchI] = 0; - } - Info<< "Patch " << patch.name() << " is wall:" - << wall_flags[patchI] << endl; - } - - //- Find all volFields and add them to database - createFieldNames(db_.runTime(), Times, setName); - - *num_vars = db_.volScalarNames().size() + 3*db_.volVectorNames().size(); - - if (*num_vars > *max_vars) - { - errorMsg("Too many variables. FieldView limit:" + name(*max_vars)); - - *iret = 1; - - return; - } - - - int nameI = 0; - - forAll(db_.volScalarNames(), i) - { - const word& fieldName = db_.volScalarNames()[i]; - - const word& fvName = db_.getFvName(fieldName); - - strcpy(var_names[nameI++], fvName.c_str()); - } - - forAll(db_.volVectorNames(), i) - { - const word& fieldName = db_.volVectorNames()[i]; - - const word& fvName = db_.getFvName(fieldName); - - strcpy(var_names[nameI++], (fvName + "x;" + fvName).c_str()); - strcpy(var_names[nameI++], (fvName + "y").c_str()); - strcpy(var_names[nameI++], (fvName + "z").c_str()); - } - - *iret = 0; -} - - -/* - * Callback for reading timestep. Taken from user/user_unstruct_combined.f - */ -void user_read_one_grid_function -( - int* iunit, /* in: fortran unit number */ - int* igrid, /* in: grid number to read */ - int* nodecnt, /* in: number of nodes to read */ - float xyz[], /* out: coordinates of nodes: x1..xN y1..yN z1..zN */ - int* num_vars, /* in: number of results per node */ - float vars[], /* out: values per node */ - int* iret /* out: return value */ -) -{ - fprintf(stderr, "\n** user_read_one_grid_function\n"); - - if (*igrid != 1) - { - errorMsg("Illegal grid number " + Foam::name(*igrid)); - - *iret = 1; - - return; - } - - // Get current time - instantList Times = db_.runTime().times(); - - // Set database time and update mesh. - // Note: this should not be nessecary here. We already have the correct - // time set and mesh loaded. This is only nessecary because Fieldview - // otherwise thinks the case is non-transient. - if (!selectTime(Times, iret)) - { - return; - } - - - const fvMesh& mesh = db_.mesh(); - - // With mesh now loaded check for change in number of points. - label nTotPoints = mesh.nPoints() + db_.polys().size(); - - if (*nodecnt != nTotPoints) - { - errorMsg - ( - "nodecnt differs from number of points in mesh.\nnodecnt:" - + Foam::name(*nodecnt) - + " mesh:" - + Foam::name(nTotPoints) - ); - - *iret = 1; - - return; - } - - - if - ( - *num_vars - != (db_.volScalarNames().size() + 3*db_.volVectorNames().size()) - ) - { - errorMsg("Illegal number of variables " + name(*num_vars)); - - *iret = 1; - - return; - } - - // - // Set coordinates - // - - const pointField& points = mesh.points(); - - int xIndex = 0; - int yIndex = xIndex + nTotPoints; - int zIndex = yIndex + nTotPoints; - - // Add mesh points first. - forAll(points, pointI) - { - xyz[xIndex++] = points[pointI].x(); - xyz[yIndex++] = points[pointI].y(); - xyz[zIndex++] = points[pointI].z(); - } - - // Add cell centres of polys - const pointField& ctrs = mesh.cellCentres(); - - const labelList& polys = db_.polys(); - - forAll(polys, i) - { - label cellI = polys[i]; - - xyz[xIndex++] = ctrs[cellI].x(); - xyz[yIndex++] = ctrs[cellI].y(); - xyz[zIndex++] = ctrs[cellI].z(); - } - - - // - // Define elements by calling fv routines - // - - static const cellModel& tet = *(cellModeller::lookup("tet")); - static const cellModel& tetWedge = *(cellModeller::lookup("tetWedge")); - static const cellModel& pyr = *(cellModeller::lookup("pyr")); - static const cellModel& prism = *(cellModeller::lookup("prism")); - static const cellModel& wedge = *(cellModeller::lookup("wedge")); - static const cellModel& hex = *(cellModeller::lookup("hex")); - //static const cellModel& splitHex = *(cellModeller::lookup("splitHex")); - - int tetVerts[4]; - int pyrVerts[5]; - int prismVerts[6]; - int hexVerts[8]; - - int tetFaces[4]; - int pyrFaces[5]; - int prismFaces[5]; - int hexFaces[6]; - - const cellShapeList& cellShapes = mesh.cellShapes(); - const faceList& faces = mesh.faces(); - const cellList& cells = mesh.cells(); - const labelList& owner = mesh.faceOwner(); - label nPoints = mesh.nPoints(); - - // Fieldview face_types array with all faces marked as internal. - labelList internalFaces(6, 0); - - // Mark all cells next to boundary so we don't have to calculate - // wall_types for internal cells and can just pass internalFaces. - boolList wallCell(mesh.nCells(), false); - - label nWallCells = 0; - - for (label faceI = mesh.nInternalFaces(); faceI < mesh.nFaces(); faceI++) - { - label cellI = owner[faceI]; - - if (!wallCell[cellI]) - { - wallCell[cellI] = true; - - nWallCells++; - } - } - - label nPolys = 0; - - forAll(cellShapes, cellI) - { - const cellShape& cellShape = cellShapes[cellI]; - const cellModel& cellModel = cellShape.model(); - const cell& cellFaces = cells[cellI]; - - int istat = 0; - - if (cellModel == tet) - { - tetVerts[0] = cellShape[3] + 1; - tetVerts[1] = cellShape[0] + 1; - tetVerts[2] = cellShape[1] + 1; - tetVerts[3] = cellShape[2] + 1; - - if (wallCell[cellI]) - { - labelList faceTypes = - getFaceTypes(mesh, cellFaces, cellShape.faces()); - - tetFaces[0] = faceTypes[2]; - tetFaces[1] = faceTypes[3]; - tetFaces[2] = faceTypes[0]; - tetFaces[3] = faceTypes[1]; - - istat = create_tet(ITYPE, tetVerts, tetFaces); - } - else - { - // All faces internal so use precalculated zero. - istat = create_tet(ITYPE, tetVerts, internalFaces.begin()); - } - } - else if (cellModel == tetWedge) - { - prismVerts[0] = cellShape[0] + 1; - prismVerts[1] = cellShape[3] + 1; - prismVerts[2] = cellShape[4] + 1; - prismVerts[3] = cellShape[1] + 1; - prismVerts[4] = cellShape[4] + 1; - prismVerts[5] = cellShape[2] + 1; - - if (wallCell[cellI]) - { - labelList faceTypes = - getFaceTypes(mesh, cellFaces, cellShape.faces()); - - prismFaces[0] = faceTypes[1]; - prismFaces[1] = faceTypes[2]; - prismFaces[2] = faceTypes[3]; - prismFaces[3] = faceTypes[0]; - prismFaces[4] = faceTypes[3]; - - istat = create_prism(ITYPE, prismVerts, prismFaces); - } - else - { - istat = create_prism(ITYPE, prismVerts, internalFaces.begin()); - } - } - else if (cellModel == pyr) - { - pyrVerts[0] = cellShape[0] + 1; - pyrVerts[1] = cellShape[1] + 1; - pyrVerts[2] = cellShape[2] + 1; - pyrVerts[3] = cellShape[3] + 1; - pyrVerts[4] = cellShape[4] + 1; - - if (wallCell[cellI]) - { - labelList faceTypes = - getFaceTypes(mesh, cellFaces, cellShape.faces()); - - pyrFaces[0] = faceTypes[0]; - pyrFaces[1] = faceTypes[3]; - pyrFaces[2] = faceTypes[2]; - pyrFaces[3] = faceTypes[1]; - pyrFaces[4] = faceTypes[4]; - - istat = create_pyramid(ITYPE, pyrVerts, pyrFaces); - } - else - { - istat = create_pyramid(ITYPE, pyrVerts, internalFaces.begin()); - } - } - else if (cellModel == prism) - { - prismVerts[0] = cellShape[0] + 1; - prismVerts[1] = cellShape[3] + 1; - prismVerts[2] = cellShape[4] + 1; - prismVerts[3] = cellShape[1] + 1; - prismVerts[4] = cellShape[5] + 1; - prismVerts[5] = cellShape[2] + 1; - - if (wallCell[cellI]) - { - labelList faceTypes = - getFaceTypes(mesh, cellFaces, cellShape.faces()); - - prismFaces[0] = faceTypes[4]; - prismFaces[1] = faceTypes[2]; - prismFaces[2] = faceTypes[3]; - prismFaces[3] = faceTypes[0]; - prismFaces[4] = faceTypes[1]; - - istat = create_prism(ITYPE, prismVerts, prismFaces); - } - else - { - istat = create_prism(ITYPE, prismVerts, internalFaces.begin()); - } - } - else if (cellModel == wedge) - { - hexVerts[0] = cellShape[0] + 1; - hexVerts[1] = cellShape[1] + 1; - hexVerts[2] = cellShape[0] + 1; - hexVerts[3] = cellShape[2] + 1; - hexVerts[4] = cellShape[3] + 1; - hexVerts[5] = cellShape[4] + 1; - hexVerts[6] = cellShape[6] + 1; - hexVerts[7] = cellShape[5] + 1; - - if (wallCell[cellI]) - { - labelList faceTypes = - getFaceTypes(mesh, cellFaces, cellShape.faces()); - - hexFaces[0] = faceTypes[2]; - hexFaces[1] = faceTypes[3]; - hexFaces[2] = faceTypes[0]; - hexFaces[3] = faceTypes[1]; - hexFaces[4] = faceTypes[4]; - hexFaces[5] = faceTypes[5]; - - istat = create_hex(ITYPE, hexVerts, hexFaces); - } - else - { - istat = create_hex(ITYPE, hexVerts, internalFaces.begin()); - } - } - else if (cellModel == hex) - { - hexVerts[0] = cellShape[0] + 1; - hexVerts[1] = cellShape[1] + 1; - hexVerts[2] = cellShape[3] + 1; - hexVerts[3] = cellShape[2] + 1; - hexVerts[4] = cellShape[4] + 1; - hexVerts[5] = cellShape[5] + 1; - hexVerts[6] = cellShape[7] + 1; - hexVerts[7] = cellShape[6] + 1; - - if (wallCell[cellI]) - { - labelList faceTypes = - getFaceTypes(mesh, cellFaces, cellShape.faces()); - - hexFaces[0] = faceTypes[0]; - hexFaces[1] = faceTypes[1]; - hexFaces[2] = faceTypes[4]; - hexFaces[3] = faceTypes[5]; - hexFaces[4] = faceTypes[2]; - hexFaces[5] = faceTypes[3]; - - istat = create_hex(ITYPE, hexVerts, hexFaces); - } - else - { - istat = create_hex(ITYPE, hexVerts, internalFaces.begin()); - } - } - else - { - forAll(cellFaces, cFaceI) - { - label faceI = cellFaces[cFaceI]; - - // Get Fieldview facetype (internal/on patch) - label fvFaceType = getFvType(mesh, faceI); - - const face& f = faces[faceI]; - - // Indices into storage - label nQuads = 0; - label nTris = 0; - - // Storage for triangles and quads created by face - // decomposition (sized for worst case) - faceList quadFaces((f.size() - 2)/2); - faceList triFaces(f.size() - 2); - - f.trianglesQuads - ( - points, - nTris, - nQuads, - triFaces, - quadFaces - ); - - // Label of cell centre in fv point list. - label polyCentrePoint = nPoints + nPolys; - - for (label i=0; i<nTris; i++) - { - if (cellI == owner[faceI]) - { - tetVerts[0] = triFaces[i][0] + 1; - tetVerts[1] = triFaces[i][1] + 1; - tetVerts[2] = triFaces[i][2] + 1; - tetVerts[3] = polyCentrePoint + 1; - } - else - { - tetVerts[0] = triFaces[i][2] + 1; - tetVerts[1] = triFaces[i][1] + 1; - tetVerts[2] = triFaces[i][0] + 1; - tetVerts[3] = polyCentrePoint + 1; - } - - if (wallCell[cellI]) - { - // Outside face is one without polyCentrePoint - tetFaces[0] = fvFaceType; - tetFaces[1] = 0; - tetFaces[2] = 0; - tetFaces[3] = 0; - - istat = create_tet(ITYPE, tetVerts, tetFaces); - } - else - { - istat = - create_tet - ( - ITYPE, - tetVerts, - internalFaces.begin() - ); - } - } - - for (label i=0; i<nQuads; i++) - { - if (cellI == owner[faceI]) - { - pyrVerts[0] = quadFaces[i][3] + 1; - pyrVerts[1] = quadFaces[i][2] + 1; - pyrVerts[2] = quadFaces[i][1] + 1; - pyrVerts[3] = quadFaces[i][0] + 1; - pyrVerts[4] = polyCentrePoint + 1; - - } - else - { - pyrVerts[0] = quadFaces[i][0] + 1; - pyrVerts[1] = quadFaces[i][1] + 1; - pyrVerts[2] = quadFaces[i][2] + 1; - pyrVerts[3] = quadFaces[i][3] + 1; - pyrVerts[4] = polyCentrePoint + 1; - } - - if (wallCell[cellI]) - { - // Outside face is one without polyCentrePoint - pyrFaces[0] = fvFaceType; - pyrFaces[1] = 0; - pyrFaces[2] = 0; - pyrFaces[3] = 0; - pyrFaces[4] = 0; - - istat = create_pyramid(ITYPE, pyrVerts, pyrFaces); - } - else - { - istat = - create_pyramid - ( - ITYPE, - pyrVerts, - internalFaces.begin() - ); - } - } - - if (istat != 0) - { - errorMsg("Error during adding cell " + name(cellI)); - - *iret = 1; - - return; - } - } - - nPolys++; - } - - if (istat != 0) - { - errorMsg("Error during adding cell " + name(cellI)); - - *iret = 1; - - return; - } - } - - - - // - // Set fieldvalues - // - - const pointMesh& pMesh = pointMesh::New(mesh); - - volPointInterpolation pInterp(mesh, pMesh); - - int pointI = 0; - - forAll(db_.volScalarNames(), i) - { - const word& fieldName = db_.volScalarNames()[i]; - - storeScalarField(pInterp, fieldName, vars, pointI); - } - - - forAll(db_.volVectorNames(), i) - { - const word& fieldName = db_.volVectorNames()[i]; - - storeVectorField(pInterp, fieldName, vars, pointI); - } - - // Return without failure. - *iret = 0; -} - - -void register_data_readers() -{ - /* - ** - ** You should edit this file to "register" a user-defined data - ** reader with FIELDVIEW, if the user functions being registered - ** here are written in C. - ** You should edit "ftn_register_data_readers.f" if the user functions - ** being registered are written in Fortran. - ** In either case, the user functions being registered may call other - ** functions written in either language (C or Fortran); only the - ** language of the "query" and "read" functions referenced here matters - ** to FIELDVIEW. - ** - ** The following shows a sample user-defined data reader being - ** "registered" with FIELDVIEW. - ** - ** The "extern void" declarations should match the names of the - ** query and grid-reading functions you are providing. It is - ** strongly suggested that all such names begin with "user" so - ** as not to conflict with global names in FIELDVIEW. - ** - ** You may call any combination of the data reader registration - ** functions shown below ("register_two_file_reader" and/or - ** "register_single_file_reader" and/or "register_single_unstruct_reader" - ** and/or "register_double_unstruct_reader") as many times as you like, - ** in order to create several different data readers. Each data reader - ** should of course have different "query" and "read" functions, all of - ** which should also appear in "extern void" declarations. - ** - */ - - /* - ** like this for combined unstructured grids & results in a single file - */ - reg_single_unstruct_reader - ( - "Foam Reader", /* title you want for data reader */ - user_query_file_function, /* whatever you called this */ - user_read_one_grid_function /* whatever you called this */ - ); -} - - -} - - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/graphics/fieldview9Reader/readerDatabase.C b/applications/utilities/postProcessing/graphics/fieldview9Reader/readerDatabase.C deleted file mode 100644 index 7de4b9bc839..00000000000 --- a/applications/utilities/postProcessing/graphics/fieldview9Reader/readerDatabase.C +++ /dev/null @@ -1,340 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#include "readerDatabase.H" -#include "demandDrivenData.H" -#include "fvMesh.H" -#include "fvMeshSubset.H" -#include "Time.H" -#include "fileName.H" -#include "instant.H" -#include "cellSet.H" -#include "cellModeller.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -const bool Foam::readerDatabase::debug_ = Foam::env("readerDatabase"); - - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -// Gets cell numbers of all polyHedra -void Foam::readerDatabase::getPolyHedra() -{ - const cellModel& tet = *(cellModeller::lookup("tet")); - const cellModel& pyr = *(cellModeller::lookup("pyr")); - const cellModel& prism = *(cellModeller::lookup("prism")); - const cellModel& wedge = *(cellModeller::lookup("wedge")); - const cellModel& tetWedge = *(cellModeller::lookup("tetWedge")); - const cellModel& hex = *(cellModeller::lookup("hex")); - - DynamicList<label> polys(mesh().nCells()/100 + 1); - - const cellShapeList& cellShapes = mesh().cellShapes(); - - forAll(cellShapes, celli) - { - const cellShape& cellShape = cellShapes[celli]; - const cellModel& cellModel = cellShape.model(); - - if - ( - (cellModel != tet) - && (cellModel != pyr) - && (cellModel != prism) - && (cellModel != wedge) - && (cellModel != tetWedge) - && (cellModel != hex) - ) - { - polys.append(celli); - } - } - - Info<< "Found " << polys.size() << " polyhedral cells " << endl; - polys_.transfer(polys); -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -// Null constructor -Foam::readerDatabase::readerDatabase() -: - fieldviewNames_(10), - runTimePtr_(NULL), - meshPtr_(NULL), - setName_(""), - polys_(), - volScalarNames_(), - volVectorNames_() -{ - // Initialize name mapping table. See note on static in header file. - fieldviewNames_.insert("alpha", "aalpha"); - fieldviewNames_.insert("Alpha", "AAlpha"); - fieldviewNames_.insert("fsmach", "ffsmach"); - fieldviewNames_.insert("FSMach", "FFSMach"); - fieldviewNames_.insert("re", "rre"); - fieldviewNames_.insert("Re", "RRe"); - fieldviewNames_.insert("time", "ttime"); - fieldviewNames_.insert("Time", "TTime"); - fieldviewNames_.insert("pi", "ppi"); - fieldviewNames_.insert("PI", "PPI"); - fieldviewNames_.insert("x", "xx"); - fieldviewNames_.insert("X", "XX"); - fieldviewNames_.insert("y", "yy"); - fieldviewNames_.insert("Y", "YY"); - fieldviewNames_.insert("z", "zz"); - fieldviewNames_.insert("Z", "ZZ"); - fieldviewNames_.insert("rcyl", "rrcyl"); - fieldviewNames_.insert("Rcyl", "RRcyl"); - fieldviewNames_.insert("theta", "ttheta"); - fieldviewNames_.insert("Theta", "TTheta"); - fieldviewNames_.insert("rsphere", "rrsphere"); - fieldviewNames_.insert("Rsphere", "RRsphere"); - fieldviewNames_.insert("k", "kk"); - fieldviewNames_.insert("K", "KK"); -} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::readerDatabase::~readerDatabase() -{ - deleteDemandDrivenData(meshPtr_); - deleteDemandDrivenData(runTimePtr_); -} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -const Foam::Time& Foam::readerDatabase::runTime() const -{ - if (!runTimePtr_) - { - FatalErrorIn("readerDatabase::runTime()") - << "No database set" << abort(FatalError); - } - return *runTimePtr_; -} - - -const Foam::fvMesh& Foam::readerDatabase::mesh() const -{ - if (!meshPtr_) - { - FatalErrorIn("readerDatabase::runTime()") - << "No mesh set" << abort(FatalError); - } - - if (setName_.empty()) - { - return *meshPtr_; - } - else - { - return meshPtr_->subMesh(); - } -} - - -const Foam::labelList& Foam::readerDatabase::polys() const -{ - return polys_; -} - - -const Foam::wordList& Foam::readerDatabase::volScalarNames() const -{ - return volScalarNames_; -} - - -const Foam::wordList& Foam::readerDatabase::volVectorNames() const -{ - return volVectorNames_; -} - - -const Foam::word& Foam::readerDatabase::getFvName(const word& foamName) const -{ - if (fieldviewNames_.found(foamName)) - { - return fieldviewNames_[foamName]; - } - else - { - return foamName; - } -} - - -bool Foam::readerDatabase::setRunTime -( - const fileName& rootDir, - const fileName& caseName, - const word& setName -) -{ - bool newDatabase = false; - - if (runTimePtr_) - { - if - ( - (runTimePtr_->caseName() != caseName) - || (runTimePtr_->rootPath() != rootDir) - || (setName_ != setName) - ) - { - if (debug_) - { - Info<< "Deleting old mesh since deleting old database" << endl; - } - - deleteDemandDrivenData(meshPtr_); - - if (debug_) - { - Info<< "Deleting old database for " << runTimePtr_->caseName() - << endl; - } - - deleteDemandDrivenData(runTimePtr_); - } - } - - setName_ = setName; - - if (!runTimePtr_) - { - if (debug_) - { - Info<< "Deleting old mesh since loading new Time" << endl; - } - - deleteDemandDrivenData(meshPtr_); - - if (debug_) - { - Info<< "Creating database for " << caseName << endl; - } - - runTimePtr_ = new Time(Time::controlDictName, rootDir, caseName); - - newDatabase = true; - } - - return newDatabase; -} - - -void Foam::readerDatabase::loadMesh() -{ - deleteDemandDrivenData(meshPtr_); - - Info<< "Loading new mesh" << endl; - - meshPtr_ = new fvMeshSubset - ( - *runTimePtr_, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ); - - if (setName_.size()) - { - Info<< "Subsetting mesh based on cellSet " << setName_ << endl; - - fvMeshSubset& mesh = *meshPtr_; - - cellSet currentSet(mesh, setName_); - - mesh.setCellSubset(currentSet); - } - getPolyHedra(); -} - - -Foam::polyMesh::readUpdateState Foam::readerDatabase::setTime -( - const instant& timeInstance, - const label timeIndex -) -{ - runTime().setTime(timeInstance, timeIndex); - - polyMesh::readUpdateState meshChange; - - if (meshPtr_) - { - // Update loaded mesh - meshChange = meshPtr_->readUpdate(); - - if (setName_.size() && meshChange != polyMesh::UNCHANGED) - { - Info<< "Subsetting mesh based on " << setName_ << endl; - - fvMeshSubset& mesh = *meshPtr_; - - cellSet currentSet(mesh, setName_); - - mesh.setCellSubset(currentSet); - } - - if - ( - (meshChange == polyMesh::TOPO_CHANGE) - || (meshChange == polyMesh::TOPO_PATCH_CHANGE) - ) - { - getPolyHedra(); - } - } - else - { - // Force new mesh to be loaded for current time - loadMesh(); - meshChange = polyMesh::TOPO_CHANGE; - } - - return meshChange; -} - - -void Foam::readerDatabase::setFieldNames -( - const wordList& vsNames, - const wordList& vvNames -) -{ - volScalarNames_ = vsNames; - volVectorNames_ = vvNames; -} - - - - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/graphics/fieldview9Reader/readerDatabase.H b/applications/utilities/postProcessing/graphics/fieldview9Reader/readerDatabase.H deleted file mode 100644 index 9b75731a7d6..00000000000 --- a/applications/utilities/postProcessing/graphics/fieldview9Reader/readerDatabase.H +++ /dev/null @@ -1,172 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -Class - Foam::readerDatabase - -Description - Singleton caching OpenFOAM database and mesh and various. - Used in Fv reader to keep track of data in between callbacks. - -SourceFiles - readerDatabase.C - -\*---------------------------------------------------------------------------*/ - -#ifndef readerDatabase_H -#define readerDatabase_H - -#include "wordList.H" -#include "Time.H" -#include "polyMesh.H" -#include "label.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// Forward declaration of classes -class fvMesh; -class fvMeshSubset; -class Time; -class fileName; -class instant; - -/*---------------------------------------------------------------------------*\ - Class readerDatabase Declaration -\*---------------------------------------------------------------------------*/ - -class readerDatabase -{ - // Private data - - //- Names for protected Fieldview keywords. Gets set at construction - // time. - // Note: Should be static but this gives problem with construction - // order since *this is static as well. - HashTable<word> fieldviewNames_; - - // Private data - - //- Cached database - Time* runTimePtr_; - - //- Cached mesh, guaranteed uptodate with runTime. - fvMeshSubset* meshPtr_; - - //- Empty string or name of current set. - word setName_; - - //- Cell labels of polyHedra. Uptodate with meshPtr. - labelList polys_; - - //- All volScalarFields in all time directories - wordList volScalarNames_; - - //- All volVectorFields ,, - wordList volVectorNames_; - - - // Private Member Functions - - //- Gets cell numbers of all polyHedra - void getPolyHedra(); - - //- Disallow default bitwise copy construct - readerDatabase(const readerDatabase&); - - //- Disallow default bitwise assignment - void operator=(const readerDatabase&); - - -public: - - // Static - - //- Debug flag. Note: uses envvar instead of controlDict since - // *this is static as well. Might be initialized before controlDict - // read. - static const bool debug_; - - - // Constructors - - //- Construct null - readerDatabase(); - - - //- Destructor - ~readerDatabase(); - - - // Member Functions - - // Access - - const Time& runTime() const; - - const fvMesh& mesh() const; - - const labelList& polys() const; - - const wordList& volScalarNames() const; - - const wordList& volVectorNames() const; - - //- Get fieldview compatible name. - const word& getFvName(const word& foamName) const; - - // Edit - - //- Create database (if nessecary). - // Returns true if new Time created, false if old one reused. - // Optional fvMeshSubset using setName. - bool setRunTime - ( - const fileName& rootDir, - const fileName& caseName, - const word& setName - ); - - //- Forcibly load mesh. - void loadMesh(); - - //- Set time (use this instead of database::setTime), updates - // mesh as well and returns mesh update status - polyMesh::readUpdateState setTime(const instant&, const label); - - //- Set volScalarNames, volVectorNames. - void setFieldNames(const wordList&, const wordList&); -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // -- GitLab