Files
openfoam/applications/utilities/mesh/generation/blockMesh/blockMeshOBJ.H
Mark Olesen d31f351c15 ENH: blockMesh enhancements
- support non-uniform scaling, prescaling and cartesian coordinate
  transformations.

  Eg, stretch in one direction and then rotate
  ```
  prescale  (1.5 1 1);
  transform
  {
      origin   (0 0 0);
      rotation
      {
          type  axisAngle;
          axis  (0 0 1);
          angle 45;
      }
  }
  ```

- support "transformed" versions of blockMesh vertices, topology.
  With the additional of transformations etc, a simplistic application
  of a single scale parameter is no longer sufficient.

    new:  blMesh.vertices(true);
    old:  blMesh.vertices() * blMesh.scaleFactor();

    new:  blMesh.topology(true);
    old:  N/A

- add individual edge access for blockDescriptor.
  Saves copying and duplicate calculations.

- handle '(block face)' specification for curved faces,
  which is ok for external block faces, but likely somewhat
  questionable if used for internal block faces.
2021-07-28 13:14:44 +02:00

56 lines
1.7 KiB
C

/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2020-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
Description
OBJ output of blockMesh topology blocks
\*---------------------------------------------------------------------------*/
{
refPtr<polyMesh> topoMeshPtr(blocks.topology(true));
const polyMesh& topoMesh = topoMeshPtr();
// Write mesh as edges
{
OFstream os(runTime.path()/"blockTopology.obj");
Info<< "Writing block structure in obj format: "
<< os.name().name() << endl;
for (const point& p : topoMesh.points())
{
os << "v " << p.x() << ' ' << p.y() << ' ' << p.z() << nl;
}
for (const edge& e : topoMesh.edges())
{
os << "l " << e.start() + 1 << ' ' << e.end() + 1 << nl;
}
}
// Write centres of blocks
{
OFstream os(runTime.path()/"blockCentres.obj");
Info<< "Writing block centres in obj format: "
<< os.name().name() << endl;
for (const point& p : topoMesh.cellCentres())
{
os << "v " << p.x() << ' ' << p.y() << ' ' << p.z() << nl;
}
}
}
// ************************************************************************* //