/*---------------------------------------------------------------------------*\ ========= | \\ / 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 . Application extrude2DMesh Description Takes 2D mesh (all faces 2 points only, no front and back faces) and creates a 3D mesh by extruding with specified thickness. Note Not sure about the walking of the faces to create the front and back faces. \*---------------------------------------------------------------------------*/ #include "argList.H" #include "Time.H" #include "polyMesh.H" #include "extrude2DMesh.H" #include "extrudeModel.H" #include "polyTopoChange.H" #include "MeshedSurface.H" #include "edgeCollapser.H" #include "addPatchCellLayer.H" #include "patchToPoly2DMesh.H" using namespace Foam; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // enum ExtrudeMode { POLYMESH2D, MESHEDSURFACE }; namespace Foam { template<> const char* NamedEnum::names[] = { "polyMesh2D", "MeshedSurface" }; } static const NamedEnum ExtrudeModeNames; //pointField moveInitialPoints //( // primitiveFacePatch& fMesh, // const extrudeModel& model //) //{ // pointField layer0Points(fMesh.nPoints()); // pointField layer1Points(fMesh.nPoints()); // pointField displacement(fMesh.nPoints()); // forAll(layer0Points, pointI) // { // const labelList& meshPoints = fMesh.meshPoints(); // label meshPointI = meshPoints[pointI]; // layer0Points[meshPointI] = model // ( // fMesh.points()[meshPointI], // fMesh.pointNormals()[pointI], // 0 // ); // layer1Points[meshPointI] = model // ( // fMesh.points()[meshPointI], // fMesh.pointNormals()[pointI], // 1 // ); // displacement[pointI] = // layer1Points[meshPointI] // - layer0Points[meshPointI]; // } // fMesh.movePoints(layer0Points); // return displacement; //} // Main program: int main(int argc, char *argv[]) { argList::validArgs.append("surfaceFormat"); #include "setRootCase.H" Info<< "Create time\n" << endl; Time runTimeExtruded ( Time::controlDictName, args.rootPath(), args.caseName() ); runTimeExtruded.functionObjects().off(); const ExtrudeMode surfaceFormat = ExtrudeModeNames[args[1]]; Info<< "Extruding from " << ExtrudeModeNames[surfaceFormat] << " at time " << runTimeExtruded.timeName() << endl; IOdictionary extrude2DMeshDict ( IOobject ( "extrude2DMeshDict", runTimeExtruded.system(), runTimeExtruded, IOobject::MUST_READ, IOobject::NO_WRITE, false ) ); // Point generator autoPtr model(extrudeModel::New(extrude2DMeshDict)); autoPtr > fMesh; autoPtr mesh; autoPtr meshMod; labelListList extrudeEdgePatches; if (surfaceFormat == MESHEDSURFACE) { fMesh.set(new MeshedSurface("MeshedSurface.obj")); EdgeMap