62 normalToFace::typeName,
63 "\n Usage: normalToFace (nx ny nz) <tol>\n\n"
64 " Select faces with normal aligned to unit vector (nx ny nz)\n"
71void Foam::normalToFace::setNormal()
75 if (tol_ < -1 || tol_ > 1)
78 <<
"tolerance not within range -1..1 : " << tol_
93 topoSetFaceSource(
mesh),
105 tol_(
dict.get<scalar>(
"cos"))
114 normal_(checkIs(is)),
115 tol_(readScalar(checkIs(is)))
133 Info<<
" Adding faces according to normal being aligned with "
134 << normal_ <<
" (to within " << tol_ <<
") ..." <<
endl;
137 forAll(mesh_.faceAreas(), facei)
141 if (
mag(1 - (
n & normal_)) < tol_)
151 Info<<
" Removing faces according to normal being aligned with "
152 << normal_ <<
" (to within " << tol_ <<
") ..." <<
endl;
157 for (
const label facei :
static_cast<const labelHashSet&
>(set))
161 if (
mag(1 - (
n & normal_)) < tol_)
163 toBeRemoved.append(facei);
167 set.unset(toBeRemoved);
Macros for easy insertion into run-time selection tables.
#define addNamedToRunTimeSelectionTable(baseType, thisType, argNames, lookupName)
Add to construction table with 'lookupName' as the key.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void append(const T &val)
Copy append an element to the end of this list.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Vector< Cmpt > & normalise(const scalar tol=ROOTVSMALL)
Inplace normalise the vector by its magnitude.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A topoSetFaceSource to select faces whose surface normal aligned with a given direction.
normalToFace(const polyMesh &mesh, const vector &normal, const scalar tol)
Construct from components.
virtual void applyToSet(const topoSetSource::setAction action, topoSet &set) const
Apply specified action to the topoSet.
Mesh consisting of general polyhedral cells.
The topoSetFaceSource is a intermediate class for handling topoSet sources for selecting faces.
topoSetFaceSource(const polyMesh &mesh)
Construct from mesh.
Class with constructor to add usage string to table.
Base class of a source for a topoSet.
setAction
Enumeration defining various actions.
@ SUBTRACT
Subtract elements from current set.
@ ADD
Add elements to current set.
@ NEW
Create a new set and ADD elements to it.
bool verbose_
Output verbosity (default: true).
const polyMesh & mesh() const noexcept
Reference to the mesh.
const polyMesh & mesh_
Reference to the mesh.
static Istream & checkIs(Istream &is)
Check state of stream.
General set of labels of mesh quantity (points, cells, faces).
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void set(List< bool > &bools, const labelUList &locations)
Set the listed locations (assign 'true').
quaternion normalised(const quaternion &q)
Return the normalised (unit) quaternion of the given quaternion.
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
messageStream Info
Information stream (stdout output on master, null elsewhere).
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define forAll(list, i)
Loop across all elements in list.