ENH: add input surface scaling (issue #514)

- surfaceFeatureExtract
  * dictionary "scale" entry

- triSurface
- triSurfaceLoader
  * optional scaleFactor on reading

- surfaceAdd
- surfaceBooleanFeatures
- surfaceClean
- surfaceCoarsen
  * scale option

- surfaceTransformPoints, transformPoints
  * scale option as scalar or vector quantity
This commit is contained in:
Mark Olesen
2017-08-14 09:18:15 +02:00
parent aad962a0e4
commit 139edb2468
24 changed files with 305 additions and 169 deletions

View File

@ -218,7 +218,8 @@ Foam::label Foam::triSurfaceLoader::select(const wordReList& matcher)
Foam::autoPtr<Foam::triSurface> Foam::triSurfaceLoader::load
(
const enum loadingOption opt
const enum loadingOption opt,
const scalar scaleFactor
) const
{
autoPtr<triSurface> output;
@ -229,7 +230,8 @@ Foam::autoPtr<Foam::triSurface> Foam::triSurfaceLoader::load
}
else if (selected_.size() == 1)
{
output.set(new triSurface(directory_/selected_[0]));
// Use scaling (if any)
output.set(new triSurface(directory_/selected_[0], scaleFactor));
triSurface& surf = output();
@ -392,6 +394,12 @@ Foam::autoPtr<Foam::triSurface> Foam::triSurfaceLoader::load
}
}
// Apply scaling (if any)
if (scaleFactor > VSMALL)
{
points *= scaleFactor;
}
output.set(new triSurface(faces, patches, points, true));
return output;

View File

@ -154,9 +154,12 @@ public:
label select(const wordReList& matcher);
//- Load a single file, or load and combine multiple selected files
// Optionally scale the surface(s) on input, with a zero or negative
// scale factor treated as no scaling.
autoPtr<triSurface> load
(
const enum loadingOption opt = loadingOption::OFFSET_REGION
const enum loadingOption opt = loadingOption::OFFSET_REGION,
const scalar scaleFactor = -1
) const;
};