ENH: support surface writer output transform (#2505)

- this allows the "relocation" of sampled surfaces. For example,
  to reposition into a different coordinate system for importing
  into CAD.

- incorporate output scaling for all surface writer types.

  This was previously done on an adhoc basis for different writers,
  but with now included in the base-level so that all writers
  can automatically use scale + transform.

  Example:

  formatOptions
  {
      vtk
      {
          scale 1000;  // m -> mm
          transform
          {
              origin  (0.05 0 0);
              rotation axisAngle;
              axis    (0 0 1);
              angle   -45;
          }
      }
  }
This commit is contained in:
Mark Olesen 2022-06-08 12:36:36 +02:00 committed by Andrew Heather
parent 675c168014
commit ad0235a751
28 changed files with 286 additions and 127 deletions

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2020 OpenCFD Ltd.
Copyright (C) 2020-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -150,7 +150,7 @@ void Foam::surfaceWriters::abaqusWriter::writeGeometry
<< "** Points" << nl
<< "**" << nl;
fileFormats::ABAQUSCore::writePoints(os, points, geometryScale_);
fileFormats::ABAQUSCore::writePoints(os, points);
// Write faces, with on-the-fly decomposition (triangulation)
@ -237,7 +237,6 @@ void Foam::surfaceWriters::abaqusWriter::writeGeometry
Foam::surfaceWriters::abaqusWriter::abaqusWriter()
:
surfaceWriter(),
geometryScale_(1),
noGeometry_(false),
outputLayout_(outputLayoutType::BY_FIELD)
{}
@ -249,7 +248,6 @@ Foam::surfaceWriters::abaqusWriter::abaqusWriter
)
:
surfaceWriter(options),
geometryScale_(options.getOrDefault<scalar>("scale", 1)),
noGeometry_(options.getOrDefault("noGeometry", false)),
outputLayout_(outputLayoutType::BY_FIELD)
{}
@ -328,7 +326,8 @@ Foam::fileName Foam::surfaceWriters::abaqusWriter::write()
}
const meshedSurf& surf = surface();
// const meshedSurf& surf = surface();
const meshedSurfRef& surf = adjustSurface();
if (Pstream::master() || !parallel_)
{

View File

@ -31,11 +31,12 @@ Description
The formatOptions for abaqus:
\table
Property | Description | Required | Default
scale | output geometry scaling | no | 1
Property | Description | Reqd | Default
scale | Output geometry scaling | no | 1
transform | Output coordinate transform | no |
fieldLevel | Subtract field level before scaling | no | empty dict
fieldScale | Output field scaling | no | empty dict
noGeometry | Suppress geometry output (beta feature) | no | false
noGeometry | Suppress geometry output (beta feature) | no | false
\endtable
For example,
@ -112,9 +113,6 @@ class abaqusWriter
{
// Private Data
//- Output geometry scaling
const scalar geometryScale_;
//- BETA feature
bool noGeometry_;

View File

@ -126,7 +126,8 @@ Foam::fileName Foam::surfaceWriters::abaqusWriter::writeTemplate
}
const meshedSurf& surf = surface();
// const meshedSurf& surf = surface();
const meshedSurfRef& surf = adjustSurface();
if (Pstream::master() || !parallel_)
{

View File

@ -169,7 +169,8 @@ Foam::fileName Foam::surfaceWriters::boundaryDataWriter::write()
// Dummy Time to use as objectRegistry
autoPtr<Time> dummyTimePtr(Time::New(argList::envGlobalPath()));
const meshedSurf& surf = surface();
// const meshedSurf& surf = surface();
const meshedSurfRef& surf = adjustSurface();
if (Pstream::master() || !parallel_)
{
@ -230,7 +231,8 @@ Foam::fileName Foam::surfaceWriters::boundaryDataWriter::writeTemplate
// Dummy Time to use as objectRegistry
autoPtr<Time> dummyTimePtr(Time::New(argList::envGlobalPath()));
const meshedSurf& surf = surface();
// const meshedSurf& surf = surface();
const meshedSurfRef& surf = adjustSurface();
if (Pstream::master() || !parallel_)
{

View File

@ -49,6 +49,8 @@ Description
header | Generate files with FoamFile header | no | true
format | ascii/binary | no | ascii
compression | Use file compression | no | false
scale | Output geometry scaling | no | 1
transform | Output coordinate transform | no |
fieldLevel | Subtract field level before scaling | no | empty dict
fieldScale | Output field scaling | no | empty dict
\endtable

View File

@ -31,6 +31,8 @@ License
#include "Time.H"
#include "globalIndex.H"
#include "coordinateRotation.H"
#include "transformField.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -44,8 +46,6 @@ namespace Foam
Foam::scalar Foam::surfaceWriter::defaultMergeDim = 1e-8;
const Foam::meshedSurf::emptySurface Foam::surfaceWriter::emptySurface_;
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
@ -139,9 +139,12 @@ Foam::surfaceWriter::New
Foam::surfaceWriter::surfaceWriter()
:
surf_(std::cref<meshedSurf>(emptySurface_)),
surfComp_(),
useComponents_(false),
surf_(),
mergedSurf_(),
adjustedSurf_(),
mergeDim_(defaultMergeDim),
geometryScale_(1),
geometryTransform_(),
upToDate_(false),
wroteGeom_(false),
parallel_(true),
@ -149,8 +152,6 @@ Foam::surfaceWriter::surfaceWriter()
isPointData_(false),
verbose_(false),
nFields_(0),
mergeDim_(defaultMergeDim),
merged_(),
currTime_(),
outputPath_(),
fieldLevel_(),
@ -165,6 +166,20 @@ Foam::surfaceWriter::surfaceWriter(const dictionary& options)
surfaceWriter()
{
options.readIfPresent("verbose", verbose_);
geometryScale_ = 1;
geometryTransform_.clear();
options.readIfPresent("scale", geometryScale_);
const dictionary* dictptr;
// Optional cartesian coordinate system transform
if ((dictptr = options.findDict("transform", keyType::LITERAL))!= nullptr)
{
geometryTransform_ = coordSystem::cartesian(*dictptr);
}
fieldLevel_ = options.subOrEmptyDict("fieldLevel");
fieldScale_ = options.subOrEmptyDict("fieldScale");
}
@ -294,9 +309,7 @@ void Foam::surfaceWriter::clear()
{
close();
expire();
useComponents_ = false;
surf_ = std::cref<meshedSurf>(emptySurface_);
surfComp_.clear();
surf_.clear();
}
@ -307,9 +320,7 @@ void Foam::surfaceWriter::setSurface
)
{
expire();
useComponents_ = false;
surf_ = std::cref<meshedSurf>(surf);
surfComp_.clear();
surf_.reset(surf);
parallel_ = (parallel && Pstream::parRun());
}
@ -322,9 +333,7 @@ void Foam::surfaceWriter::setSurface
)
{
expire();
useComponents_ = true;
surf_ = std::cref<meshedSurf>(emptySurface_);
surfComp_.reset(points, faces);
surf_.reset(points, faces);
parallel_ = (parallel && Pstream::parRun());
}
@ -366,7 +375,8 @@ bool Foam::surfaceWriter::expire()
upToDate_ = false;
wroteGeom_ = false;
merged_.clear();
adjustedSurf_.clear();
mergedSurf_.clear();
// Field count (nFields_) is a different type of accounting
// and is unaffected by geometry changes
@ -377,18 +387,13 @@ bool Foam::surfaceWriter::expire()
bool Foam::surfaceWriter::hasSurface() const
{
return (useComponents_ || (&emptySurface_ != &(surf_.get())));
return surf_.valid();
}
bool Foam::surfaceWriter::empty() const
{
const bool value =
(
useComponents_
? surfComp_.faces().empty()
: surf_.get().faces().empty()
);
const bool value = surf_.faces().empty();
return (parallel_ ? returnReduce(value, andOp<bool>()) : value);
}
@ -396,12 +401,7 @@ bool Foam::surfaceWriter::empty() const
Foam::label Foam::surfaceWriter::size() const
{
const label value =
(
useComponents_
? surfComp_.faces().size()
: surf_.get().faces().size()
);
const label value = surf_.faces().size();
return (parallel_ ? returnReduce(value, sumOp<label>()) : value);
}
@ -422,17 +422,20 @@ bool Foam::surfaceWriter::merge() const
{
bool changed = false;
if (parallel_ && Pstream::parRun() && !upToDate_)
if (!upToDate_)
{
if (useComponents_)
adjustedSurf_.clear();
if (parallel_ && Pstream::parRun())
{
changed = merged_.merge(surfComp_, mergeDim_);
changed = mergedSurf_.merge(surf_, mergeDim_);
}
else
{
changed = merged_.merge(surf_.get(), mergeDim_);
mergedSurf_.clear();
}
}
upToDate_ = true;
if (changed)
@ -450,17 +453,45 @@ const Foam::meshedSurf& Foam::surfaceWriter::surface() const
if (parallel_ && Pstream::parRun())
{
return merged_;
return mergedSurf_;
}
if (useComponents_)
return surf_;
}
const Foam::meshedSurfRef& Foam::surfaceWriter::adjustSurface() const
{
if (!upToDate_)
{
return surfComp_;
adjustedSurf_.clear();
}
else
if (!adjustedSurf_.valid())
{
return surf_.get();
adjustedSurf_.reset(surface());
if
(
geometryTransform_.valid()
&&
(
(magSqr(geometryTransform_.origin()) > ROOTVSMALL)
|| !geometryTransform_.R().is_identity()
)
)
{
// Forward transform
adjustedSurf_.movePoints
(
geometryTransform_.globalPosition(adjustedSurf_.points0())
);
}
adjustedSurf_.scalePoints(geometryScale_);
}
return adjustedSurf_;
}
@ -488,11 +519,11 @@ Foam::tmp<Foam::Field<Type>> Foam::surfaceWriter::mergeFieldTemplate
(
Pstream::master()
&& this->isPointData()
&& merged_.pointsMap().size()
&& mergedSurf_.pointsMap().size()
)
{
inplaceReorder(merged_.pointsMap(), allFld);
allFld.resize(merged_.points().size());
inplaceReorder(mergedSurf_.pointsMap(), allFld);
allFld.resize(mergedSurf_.points().size());
}
return tfield;
@ -577,6 +608,28 @@ Foam::tmp<Foam::Field<Type>> Foam::surfaceWriter::adjustFieldTemplate
// Apply scaling
tadjusted.ref() *= value;
}
// Rotate fields (vector and non-spherical tensors)
if
(
(pTraits<Type>::rank != 0 && pTraits<Type>::nComponents > 1)
&& geometryTransform_.valid()
&& !geometryTransform_.R().is_identity()
)
{
if (!tadjusted)
{
// Steal or clone
tadjusted.reset(tfield.ptr());
}
Foam::transform
(
tadjusted.ref(),
geometryTransform_.R(),
tadjusted()
);
}
}
return (tadjusted ? tadjusted : tfield);

View File

@ -57,16 +57,28 @@ Description
{
"p.*" 0.01; // [Pa] -> [mbar]
}
scale 1000; // [m] -> [mm]
transform
{
origin (0 0 0);
rotation axisAngle;
axis (1 0 0);
angle 45;
}
}
}
\endverbatim
Format options:
\table
Property | Description | Required | Default
verbose | Additional output verbosity | no | no
fieldLevel | Subtract field level before scaling | no | empty dict
fieldScale | Output field scaling | no | empty dict
Property | Description | Reqd | Default
verbose | Additional output verbosity | no | no
scale | Output geometry scaling | no | 1
transform | Output coordinate transform | no |
fieldLevel | Subtract field level before scaling | no | empty dict
fieldScale | Output field scaling | no | empty dict
\endtable
Note
@ -83,10 +95,10 @@ SourceFiles
#ifndef Foam_surfaceWriter_H
#define Foam_surfaceWriter_H
#include <functional>
#include "typeInfo.H"
#include "autoPtr.H"
#include "tmp.H"
#include "cartesianCS.H"
#include "Field.H"
#include "fileName.H"
#include "instant.H"
@ -118,23 +130,31 @@ class surfaceWriter
{
protected:
// Static Data Members
// Private Data
//- Placeholder
static const meshedSurf::emptySurface emptySurface_;
//- Reference to surface or surface components
meshedSurfRef surf_;
//- Surface after merging (parallel)
mutable mergedSurf mergedSurf_;
//- The surface after point coordinate transforms and scaling
mutable meshedSurfRef adjustedSurf_;
//- Dimension for merging
scalar mergeDim_;
//- Output geometry scaling after rotate/translate
scalar geometryScale_;
//- Local coordinate system transformation
coordSystem::cartesian geometryTransform_;
protected:
// Protected Data
//- Reference to a surface
std::reference_wrapper<const meshedSurf> surf_;
//- Reference to raw surface components
meshedSurfRef surfComp_;
//- Use raw surface components instead of surface reference
bool useComponents_;
//- The topology/surface is up-to-date?
mutable bool upToDate_;
@ -156,12 +176,6 @@ protected:
//- The number of fields
label nFields_;
//- Dimension for merging
scalar mergeDim_;
//- Merging information and the resulting merged surface (parallel)
mutable mergedSurf merged_;
//- The current time value/name
instant currTime_;
@ -184,10 +198,14 @@ protected:
//- or simply mark the surface as being up-to-date
virtual bool merge() const;
//- Merge surfaces (if not upToDate) and return merged or
//- the regular surface
//- Merge surfaces (if not upToDate) and return merged (parallel)
//- or regular surface (non-parallel)
const meshedSurf& surface() const;
//- Merge surfaces (if not upToDate) and return merged (parallel)
//- or regular surface (non-parallel)
//- and apply any coordinate system changes and/or output scaling.
const meshedSurfRef& adjustSurface() const;
//- Gather (merge) fields with renumbering and shrinking for point data
template<class Type>
@ -433,6 +451,16 @@ public:
// \return old value
inline scalar mergeDim(const scalar dist) noexcept;
//- The current value of the geometry scaling
inline scalar scale() const noexcept;
//- Change the geometry scaling
// \return old value
inline scalar scale(const scalar factor) noexcept;
//- The current (cartesian) coordinate system transformation
inline const coordSystem::cartesian& transform() const noexcept;
// Time

View File

@ -103,6 +103,28 @@ inline Foam::scalar Foam::surfaceWriter::mergeDim(const scalar dist) noexcept
}
inline Foam::scalar Foam::surfaceWriter::scale() const noexcept
{
return geometryScale_;
}
inline Foam::scalar Foam::surfaceWriter::scale(const scalar factor) noexcept
{
// This is probably not yet needed -> adjustedSurf_.clear();
scalar old(geometryScale_);
geometryScale_ = factor;
return old;
}
inline const Foam::coordSystem::cartesian&
Foam::surfaceWriter::transform() const noexcept
{
return geometryTransform_;
}
inline bool Foam::surfaceWriter::hasTime() const
{
return currTime_.name().size();

View File

@ -45,7 +45,9 @@ Description
\table
Property | Description | Required | Default
format | ascii/binary | no | ascii
collateTimes | use common geometry for times | no | true
collateTimes | Use common geometry for times | no | true
scale | Output geometry scaling | no | 1
transform | Output coordinate transform | no |
fieldLevel | Subtract field level before scaling | no | empty dict
fieldScale | Output field scaling | no | empty dict
\endtable

View File

@ -94,7 +94,8 @@ Foam::fileName Foam::surfaceWriters::ensightWriter::writeCollated
Info<< endl;
}
const meshedSurf& surf = surface();
// const meshedSurf& surf = surface();
const meshedSurfRef& surf = adjustSurface();
if (Pstream::master() || !parallel_)
{

View File

@ -59,7 +59,8 @@ Foam::fileName Foam::surfaceWriters::ensightWriter::writeUncollated()
}
const meshedSurf& surf = surface();
// const meshedSurf& surf = surface();
const meshedSurfRef& surf = adjustSurface();
if (Pstream::master() || !parallel_)
{
@ -159,7 +160,8 @@ Foam::fileName Foam::surfaceWriters::ensightWriter::writeUncollated
Info<< endl;
}
const meshedSurf& surf = surface();
// const meshedSurf& surf = surface();
const meshedSurfRef& surf = adjustSurface();
if (Pstream::master() || !parallel_)
{

View File

@ -119,7 +119,8 @@ Foam::fileName Foam::surfaceWriters::foamWriter::write()
}
const meshedSurf& surf = surface();
// const meshedSurf& surf = surface();
const meshedSurfRef& surf = adjustSurface();
if (Pstream::master() || !parallel_)
{

View File

@ -53,7 +53,9 @@ Description
\table
Property | Description | Required | Default
format | ascii/binary | no | ascii
compression | output file compression | no | false
compression | Use file compression | no | false
scale | Output geometry scaling | no | 1
transform | Output coordinate transform | no |
fieldLevel | Subtract field level before scaling | no | empty dict
fieldScale | Output field scaling | no | empty dict
\endtable

View File

@ -196,7 +196,7 @@ void Foam::surfaceWriters::nastranWriter::writeGeometry
forAll(points, pointi)
{
writeCoord(os, points[pointi]*geometryScale_, pointi);
writeCoord(os, points[pointi], pointi);
}
// Write faces, with on-the-fly decomposition (triangulation)
@ -310,7 +310,6 @@ Foam::surfaceWriters::nastranWriter::nastranWriter()
writeFormat_(fieldFormat::SHORT),
fieldMap_(),
commonGeometry_(false),
geometryScale_(1),
separator_()
{
// if (writeFormat_ == fieldFormat::FREE)
@ -337,7 +336,6 @@ Foam::surfaceWriters::nastranWriter::nastranWriter
),
fieldMap_(),
commonGeometry_(options.getOrDefault("commonGeometry", false)),
geometryScale_(options.getOrDefault<scalar>("scale", 1)),
separator_()
{
if (writeFormat_ == fieldFormat::FREE)
@ -411,7 +409,8 @@ Foam::fileName Foam::surfaceWriters::nastranWriter::write()
}
const meshedSurf& surf = surface();
// const meshedSurf& surf = surface();
const meshedSurfRef& surf = adjustSurface();
if (Pstream::master() || !parallel_)
{

View File

@ -32,13 +32,14 @@ Description
The formatOptions for nastran:
\table
Property | Description | Required | Default
fields | field pairs for PLOAD2/PLOAD4 | yes |
format | short / long / free | no | long
scale | output geometry scaling | no | 1
Property | Description | Reqd | Default
fields | Field pairs for PLOAD2/PLOAD4 | yes |
format | Nastran format (short/long/free) | no | long
scale | Output geometry scaling | no | 1
transform | Output coordinate transform | no |
fieldLevel | Subtract field level before scaling | no | empty dict
fieldScale | Output field scaling | no | empty dict
commonGeometry | use separate geometry files | no | false
commonGeometry | use separate geometry files | no | false
\endtable
For example,
@ -144,9 +145,6 @@ private:
//- Use common geometry file
bool commonGeometry_;
//- Output geometry scaling
const scalar geometryScale_;
//- Separator (used for free format)
word separator_;

View File

@ -232,7 +232,8 @@ Foam::fileName Foam::surfaceWriters::nastranWriter::writeTemplate
}
const meshedSurf& surf = surface();
// const meshedSurf& surf = surface();
const meshedSurfRef& surf = adjustSurface();
if (Pstream::master() || !parallel_)
{

View File

@ -125,7 +125,8 @@ Foam::fileName Foam::surfaceWriters::proxyWriter::write()
Info<< "Writing geometry to " << outputFile << endl;
}
const meshedSurf& surf = surface();
// const meshedSurf& surf = surface();
const meshedSurfRef& surf = adjustSurface();
if (Pstream::master() || !parallel_)
{

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2015-2020 OpenCFD Ltd.
Copyright (C) 2015-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -51,7 +51,9 @@ Note
\table
Property | Description | Required | Default
format | ascii/binary | no | ascii
compression | File compression | no | false
compression | Use file compression | no | false
scale | Output geometry scaling | no | 1
transform | Output coordinate transform | no |
\endtable
SourceFiles

View File

@ -61,8 +61,7 @@ Foam::surfaceWriters::rawWriter::rawWriter()
surfaceWriter(),
streamOpt_(),
precision_(IOstream::defaultPrecision()),
writeNormal_(false),
geometryScale_(1)
writeNormal_(false)
{}
@ -81,8 +80,7 @@ Foam::surfaceWriters::rawWriter::rawWriter
(
options.getOrDefault("precision", IOstream::defaultPrecision())
),
writeNormal_(options.getOrDefault("normal", false)),
geometryScale_(options.getOrDefault<scalar>("scale", 1))
writeNormal_(options.getOrDefault("normal", false))
{}
@ -137,7 +135,8 @@ Foam::fileName Foam::surfaceWriters::rawWriter::write()
}
const meshedSurf& surf = surface();
// const meshedSurf& surf = surface();
const meshedSurfRef& surf = adjustSurface();
if (Pstream::master() || !parallel_)
{
@ -167,11 +166,11 @@ Foam::fileName Foam::surfaceWriters::rawWriter::write()
// Write faces centres (optionally faceArea normals)
for (const face& f : faces)
{
writePoint(os, f.centre(points)*geometryScale_);
writePoint(os, f.centre(points));
if (withFaceNormal)
{
os << ' ';
writePoint(os, f.areaNormal(points)*geometryScale_);
writePoint(os, f.areaNormal(points));
}
os << nl;
}

View File

@ -34,8 +34,9 @@ Description
\table
Property | Description | Required | Default
compression | Use file compression | no | false
precision | Write precision in ascii | no | same as IOstream
precision | Write precision in ascii | no | same as IOstream
scale | Output geometry scaling | no | 1
transform | Output coordinate transform | no |
fieldLevel | Subtract field level before scaling | no | empty dict
fieldScale | Output field scaling | no | empty dict
normal | Write face area normal in output | no | false
@ -116,9 +117,6 @@ class rawWriter
//- Output face area normal
const bool writeNormal_;
//- Output geometry scaling
const scalar geometryScale_;
// Private Member Functions

View File

@ -114,7 +114,8 @@ Foam::fileName Foam::surfaceWriters::rawWriter::writeTemplate
Info<< " to " << outputFile << endl;
}
const meshedSurf& surf = surface();
// const meshedSurf& surf = surface();
const meshedSurfRef& surf = adjustSurface();
if (Pstream::master() || !parallel_)
{
@ -159,7 +160,7 @@ Foam::fileName Foam::surfaceWriters::rawWriter::writeTemplate
// Node values
forAll(values, elemi)
{
writePoint(os, points[elemi]*geometryScale_);
writePoint(os, points[elemi]);
writeData(os, values[elemi]);
os << nl;
}
@ -171,12 +172,12 @@ Foam::fileName Foam::surfaceWriters::rawWriter::writeTemplate
{
const face& f = faces[elemi];
writePoint(os, f.centre(points)*geometryScale_);
writePoint(os, f.centre(points));
writeData(os, values[elemi]);
if (withFaceNormal)
{
os << ' ';
writePoint(os, f.areaNormal(points)*geometryScale_);
writePoint(os, f.areaNormal(points));
}
os << nl;
}

View File

@ -137,7 +137,8 @@ Foam::fileName Foam::surfaceWriters::starcdWriter::write()
Info<< "Writing geometry to " << outputFile << endl;
}
const meshedSurf& surf = surface();
// const meshedSurf& surf = surface();
const meshedSurfRef& surf = adjustSurface();
if (Pstream::master() || !parallel_)
{
@ -215,7 +216,8 @@ Foam::fileName Foam::surfaceWriters::starcdWriter::writeTemplate
}
const meshedSurf& surf = surface();
// const meshedSurf& surf = surface();
const meshedSurfRef& surf = adjustSurface();
if (Pstream::master() || !parallel_)
{

View File

@ -34,6 +34,8 @@ Description
\table
Property | Description | Required | Default
compression | Use file compression | no | false
scale | Output geometry scaling | no | 1
transform | Output coordinate transform | no |
fieldLevel | Subtract field level before scaling | no | empty dict
fieldScale | Output field scaling | no | empty dict
\endtable

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019-2021 OpenCFD Ltd.
Copyright (C) 2019-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -212,7 +212,8 @@ Foam::fileName Foam::surfaceWriters::vtkWriter::write()
Info<< "Writing geometry to " << outputFile << endl;
}
const meshedSurf& surf = surface();
// const meshedSurf& surf = surface();
const meshedSurfRef& surf = adjustSurface();
if (!writer_ && (Pstream::master() || !parallel_))
{

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2015-2021 OpenCFD Ltd.
Copyright (C) 2015-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -36,6 +36,8 @@ Description
format | ascii or binary format | no | binary
legacy | Legacy VTK output | no | false
precision | Write precision in ascii | no | same as IOstream
scale | Output geometry scaling | no | 1
transform | Output coordinate transform | no |
fieldLevel | Subtract field level before scaling | no | empty dict
fieldScale | Output field scaling | no | empty dict
normal | Write face area-normal in output | no | false

View File

@ -214,7 +214,8 @@ Foam::fileName Foam::surfaceWriters::x3dWriter::write()
Info<< "Writing geometry to " << outputFile << endl;
}
const meshedSurf& surf = surface();
// const meshedSurf& surf = surface();
const meshedSurfRef& surf = adjustSurface();
if (Pstream::master() || !parallel_)
{
@ -278,7 +279,8 @@ Foam::fileName Foam::surfaceWriters::x3dWriter::writeTemplate
}
const meshedSurf& surf = surface();
// const meshedSurf& surf = surface();
const meshedSurfRef& surf = adjustSurface();
if (Pstream::master() || !parallel_)
{

View File

@ -32,9 +32,11 @@ Description
The formatOptions for x3d:
\table
Property | Description | Required | Default
compression | Use file compression | no | false
range | The min/max range for colour table | no | automatic
colourMap | The colour map for rendering | no | coolToWarm
compression | Use file compression | no | false
scale | Output geometry scaling | no | 1
transform | Output coordinate transform | no |
fieldLevel | Subtract field level before scaling | no | empty dict
fieldScale | Output field scaling | no | empty dict
\endtable

View File

@ -92,9 +92,9 @@ plane
libs (sampling);
writeControl writeTime;
fields ( cellZoneID U );
surfaceFormat vtk;
fields ( cellZoneID U );
surfaces
{
@ -104,6 +104,25 @@ plane
point (0 0 0);
normal (0 0 1);
interpolate false;
surfaceFormat ensight;
formatOptions
{
ensight
{
scale 2; // Some arbitrary scaling
// Align with global x-axis, translate by arbitrary amount
transform
{
origin (0.05 -0.05 0);
rotation axisAngle;
axis (0 0 1);
angle -45;
}
}
}
}
slices
@ -122,6 +141,23 @@ plane
axis (0 0 1);
angle 45;
}
formatOptions
{
vtk
{
scale 2; // Some arbitrary scaling
// Align with global x-axis, translate by arbitrary amount
transform
{
origin (0.05 0 0);
rotation axisAngle;
axis (0 0 1);
angle -45;
}
}
}
}
}
}