COMP: ensight writer compilation for 64-bit labels (issue #263)
GIT: added missing source file. ENH: add tutorial example under incompressible/simpleFoam/motorBike
This commit is contained in:
parent
b2ee629a94
commit
aca0b1ca04
@ -0,0 +1,91 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\/ 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 "meshSubsetHelper.H"
|
||||
|
||||
#include "cellSet.H"
|
||||
#include "cellZone.H"
|
||||
#include "Time.H"
|
||||
#include "IOstreams.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::meshSubsetHelper::meshSubsetHelper
|
||||
(
|
||||
fvMesh& baseMesh,
|
||||
const word& name,
|
||||
const bool isCellSet
|
||||
)
|
||||
:
|
||||
baseMesh_(baseMesh),
|
||||
subsetter_(baseMesh),
|
||||
name_(name),
|
||||
type_(name_.empty() ? 0 : isCellSet ? 1 : 2)
|
||||
{
|
||||
correct();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::meshSubsetHelper::correct(bool verbose)
|
||||
{
|
||||
if (type_ == 1)
|
||||
{
|
||||
if (verbose)
|
||||
{
|
||||
Info<< "Subsetting mesh based on cellSet " << name_ << endl;
|
||||
}
|
||||
|
||||
cellSet subset(baseMesh_, name_);
|
||||
subsetter_.setLargeCellSubset(subset);
|
||||
}
|
||||
else if (type_ == 2)
|
||||
{
|
||||
if (verbose)
|
||||
{
|
||||
Info<< "Subsetting mesh based on cellZone " << name_ << endl;
|
||||
}
|
||||
|
||||
labelHashSet subset(baseMesh_.cellZones()[name_]);
|
||||
subsetter_.setLargeCellSubset(subset, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::polyMesh::readUpdateState Foam::meshSubsetHelper::readUpdate()
|
||||
{
|
||||
polyMesh::readUpdateState meshState = baseMesh_.readUpdate();
|
||||
|
||||
if (meshState != polyMesh::UNCHANGED)
|
||||
{
|
||||
correct(true);
|
||||
}
|
||||
|
||||
return meshState;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
@ -43,7 +43,7 @@ namespace Foam
|
||||
>::names[] = { "tetra4", "pyramid5", "penta6", "hexa8", "nfaced" };
|
||||
}
|
||||
|
||||
const Foam::NamedEnum<Foam::ensightCells::elemType,5>
|
||||
const Foam::NamedEnum<Foam::ensightCells::elemType, 5>
|
||||
Foam::ensightCells::elemEnum;
|
||||
|
||||
|
||||
@ -73,7 +73,7 @@ void Foam::ensightCells::resize()
|
||||
{
|
||||
n += sizes_[typeI];
|
||||
}
|
||||
address_.setSize(n, 0);
|
||||
address_.setSize(n, Zero);
|
||||
|
||||
// assign corresponding sub-lists
|
||||
n = 0;
|
||||
@ -94,7 +94,7 @@ Foam::ensightCells::ensightCells(const label partIndex)
|
||||
:
|
||||
index_(partIndex),
|
||||
address_(),
|
||||
sizes_(0),
|
||||
sizes_(Zero),
|
||||
lists_()
|
||||
{
|
||||
// Ensure sub-lists are properly initialized to nullptr
|
||||
@ -111,7 +111,7 @@ Foam::ensightCells::ensightCells(const ensightCells& obj)
|
||||
:
|
||||
index_(obj.index_),
|
||||
address_(obj.address_),
|
||||
sizes_(0),
|
||||
sizes_(),
|
||||
lists_()
|
||||
{
|
||||
// Ensure sub-lists are properly initialized to nullptr
|
||||
@ -137,7 +137,6 @@ Foam::ensightCells::ensightCells(const ensightCells& obj)
|
||||
|
||||
Foam::ensightCells::~ensightCells()
|
||||
{
|
||||
sizes_ = 0;
|
||||
forAll(lists_, typeI)
|
||||
{
|
||||
deleteDemandDrivenData(lists_[typeI]);
|
||||
@ -153,7 +152,7 @@ Foam::FixedList<Foam::label, 5> Foam::ensightCells::sizes() const
|
||||
FixedList<label, 5> count;
|
||||
forAll(lists_, typeI)
|
||||
{
|
||||
count[typeI] = lists_[typeI] ? lists_[typeI]->size() : 0;
|
||||
count[typeI] = lists_[typeI]->size();
|
||||
}
|
||||
|
||||
return count;
|
||||
@ -173,7 +172,7 @@ Foam::label Foam::ensightCells::total() const
|
||||
|
||||
void Foam::ensightCells::clear()
|
||||
{
|
||||
sizes_ = 0;
|
||||
sizes_ = Zero; // reset sizes
|
||||
resize();
|
||||
}
|
||||
|
||||
@ -220,7 +219,7 @@ void Foam::ensightCells::classify
|
||||
// Count the shapes
|
||||
// Can avoid double looping, but only at the expense of allocation
|
||||
|
||||
sizes_ = 0; // reset sizes
|
||||
sizes_ = Zero; // reset sizes
|
||||
for (label listI = 0; listI < sz; ++listI)
|
||||
{
|
||||
const label id = indirect ? addressing[listI] : listI;
|
||||
@ -247,8 +246,8 @@ void Foam::ensightCells::classify
|
||||
sizes_[what]++;
|
||||
}
|
||||
|
||||
resize(); // adjust allocation
|
||||
sizes_ = 0; // reset sizes
|
||||
resize(); // adjust allocation
|
||||
sizes_ = Zero; // reset sizes
|
||||
|
||||
// Assign cell-id per shape type
|
||||
for (label listI = 0; listI < sz; ++listI)
|
||||
|
@ -43,7 +43,7 @@ namespace Foam
|
||||
>::names[] = { "tria3", "quad4", "nsided" };
|
||||
}
|
||||
|
||||
const Foam::NamedEnum<Foam::ensightFaces::elemType,3>
|
||||
const Foam::NamedEnum<Foam::ensightFaces::elemType, 3>
|
||||
Foam::ensightFaces::elemEnum;
|
||||
|
||||
|
||||
@ -109,7 +109,7 @@ void Foam::ensightFaces::resize()
|
||||
{
|
||||
n += sizes_[typeI];
|
||||
}
|
||||
address_.setSize(n, 0);
|
||||
address_.setSize(n, Zero);
|
||||
|
||||
// assign corresponding sub-lists
|
||||
n = 0;
|
||||
@ -134,7 +134,7 @@ Foam::ensightFaces::ensightFaces(label partIndex)
|
||||
index_(partIndex),
|
||||
address_(),
|
||||
flipMap_(),
|
||||
sizes_(0),
|
||||
sizes_(Zero),
|
||||
lists_()
|
||||
{
|
||||
// Ensure sub-lists are properly initialized to nullptr
|
||||
@ -152,7 +152,7 @@ Foam::ensightFaces::ensightFaces(const ensightFaces& obj)
|
||||
index_(obj.index_),
|
||||
address_(obj.address_),
|
||||
flipMap_(obj.flipMap_),
|
||||
sizes_(0),
|
||||
sizes_(),
|
||||
lists_()
|
||||
{
|
||||
// Ensure sub-lists are properly initialized to nullptr
|
||||
@ -178,7 +178,6 @@ Foam::ensightFaces::ensightFaces(const ensightFaces& obj)
|
||||
|
||||
Foam::ensightFaces::~ensightFaces()
|
||||
{
|
||||
sizes_ = 0;
|
||||
forAll(lists_, typeI)
|
||||
{
|
||||
deleteDemandDrivenData(lists_[typeI]);
|
||||
@ -215,7 +214,7 @@ Foam::label Foam::ensightFaces::total() const
|
||||
|
||||
void Foam::ensightFaces::clear()
|
||||
{
|
||||
sizes_ = 0;
|
||||
sizes_ = Zero; // reset sizes
|
||||
resize();
|
||||
}
|
||||
|
||||
@ -285,15 +284,15 @@ void Foam::ensightFaces::classify(const faceList& faces)
|
||||
// Count the shapes
|
||||
// Can avoid double looping, but only at the expense of allocation
|
||||
|
||||
sizes_ = 0; // reset sizes
|
||||
sizes_ = Zero; // reset sizes
|
||||
for (label listI = 0; listI < sz; ++listI)
|
||||
{
|
||||
const enum elemType what = whatType(faces[listI]);
|
||||
sizes_[what]++;
|
||||
}
|
||||
|
||||
resize(); // adjust allocation
|
||||
sizes_ = 0; // reset sizes
|
||||
resize(); // adjust allocation
|
||||
sizes_ = Zero; // reset sizes
|
||||
|
||||
// Assign face-id per shape type
|
||||
for (label listI = 0; listI < sz; ++listI)
|
||||
@ -320,7 +319,7 @@ void Foam::ensightFaces::classify
|
||||
// Count the shapes
|
||||
// Can avoid double looping, but only at the expense of allocation
|
||||
|
||||
sizes_ = 0; // reset sizes
|
||||
sizes_ = Zero; // reset sizes
|
||||
for (label listI = 0; listI < sz; ++listI)
|
||||
{
|
||||
const label faceId = addressing[listI];
|
||||
@ -332,8 +331,8 @@ void Foam::ensightFaces::classify
|
||||
}
|
||||
}
|
||||
|
||||
resize(); // adjust allocation
|
||||
sizes_ = 0; // reset sizes
|
||||
resize(); // adjust allocation
|
||||
sizes_ = Zero; // reset sizes
|
||||
|
||||
if (useFlip)
|
||||
{
|
||||
|
@ -50,6 +50,7 @@ functions
|
||||
#include "wallBoundedStreamLines"
|
||||
#include "cuttingPlane"
|
||||
#include "forceCoeffs"
|
||||
#include "ensightWrite"
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,17 @@
|
||||
// -*- C++ -*-
|
||||
// Minimal example of using the ensight write function object.
|
||||
// Many more options possible
|
||||
ensightWrite
|
||||
{
|
||||
type ensightWrite;
|
||||
libs ("libutilityFunctionObjects.so");
|
||||
log true;
|
||||
|
||||
// Fields to output (words or regex)
|
||||
fields (U p "(k|epsilon|omega)");
|
||||
|
||||
writeControl writeTime;
|
||||
writeIterval 1;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
Loading…
Reference in New Issue
Block a user