STYLE: place projectCurveEdge, projectEdge into blockEdges namespace

- consistent with other blockEdge types
- adjust some debug output
This commit is contained in:
Mark Olesen
2020-10-06 12:47:41 +02:00
parent 57a76e2647
commit 568cb050f2
8 changed files with 59 additions and 46 deletions

View File

@ -271,13 +271,13 @@ Foam::blockEdges::arcEdge::arcEdge
calcFromMidPoint(points_[start_], points_[end_], p); calcFromMidPoint(points_[start_], points_[end_], p);
} }
// Debug information if (debug)
#if 0 {
Info<< "arc " << start_ << ' ' << end_ Info<< "arc " << start_ << ' ' << end_ << ' '
<< ' ' << position(0.5) << ' ' << cs_ << position(0.5) << " origin " << cs_.origin() << " // ";
// << " radius=" << radius_ << " angle=" << radToDeg(angle_) cs_.rotation().write(Info);
<< nl; Info<< nl;
#endif }
} }
@ -288,8 +288,8 @@ Foam::point Foam::blockEdges::arcEdge::position(const scalar lambda) const
#ifdef FULLDEBUG #ifdef FULLDEBUG
if (lambda < -SMALL || lambda > 1 + SMALL) if (lambda < -SMALL || lambda > 1 + SMALL)
{ {
WarningInFunction InfoInFunction
<< "Parameter out of range, lambda = " << lambda << nl; << "Limit parameter to [0-1] range: " << lambda << nl;
} }
#endif #endif

View File

@ -124,8 +124,8 @@ Foam::pointField Foam::blockEdge::appendEndPoints
Foam::tmp<Foam::pointField> Foam::tmp<Foam::pointField>
Foam::blockEdge::position(const scalarList& lambdas) const Foam::blockEdge::position(const scalarList& lambdas) const
{ {
tmp<pointField> tpoints(new pointField(lambdas.size())); auto tpoints = tmp<pointField>::New(lambdas.size());
pointField& points = tpoints.ref(); auto& points = tpoints.ref();
forAll(lambdas, i) forAll(lambdas, i)
{ {
@ -135,20 +135,20 @@ Foam::blockEdge::position(const scalarList& lambdas) const
} }
void Foam::blockEdge::write(Ostream& os, const dictionary& d) const void Foam::blockEdge::write(Ostream& os, const dictionary& dict) const
{ {
blockVertex::write(os, start_, d); blockVertex::write(os, start_, dict);
os << tab; os << tab;
blockVertex::write(os, end_, d); blockVertex::write(os, end_, dict);
os << endl; os << endl;
} }
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const blockEdge& p) Foam::Ostream& Foam::operator<<(Ostream& os, const blockEdge& e)
{ {
os << p.start_ << tab << p.end_ << endl; os << e.start_ << tab << e.end_ << endl;
return os; return os;
} }

View File

@ -35,7 +35,7 @@ Class
Description Description
Define a curved edge that is parameterized for 0<lambda<1 Define a curved edge that is parameterized for 0<lambda<1
between the start and end point. between the start/end points.
SourceFiles SourceFiles
blockEdge.C blockEdge.C
@ -54,7 +54,7 @@ namespace Foam
// Forward Declarations // Forward Declarations
class blockEdge; class blockEdge;
Ostream& operator<<(Ostream&, const blockEdge&); Ostream& operator<<(Ostream& os, const blockEdge& e);
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class blockEdge Declaration Class blockEdge Declaration
@ -188,21 +188,21 @@ public:
//- Index of end point //- Index of end point
inline label end() const; inline label end() const;
//- Compare the given start and end points with this curve //- Compare the given start/end points with this block edge
// Return: // Return:
// - 0: different // - 0: different
// - +1: identical // - +1: identical
// - -1: same edge, but different orientation // - -1: same edge, but different orientation
inline int compare(const blockEdge&) const; inline int compare(const blockEdge& e) const;
//- Compare the given start and end points with this curve //- Compare the given start/end points with this block edge
// Return: // Return:
// - 0: different // - 0: different
// - +1: identical // - +1: identical
// - -1: same edge, but different orientation // - -1: same edge, but different orientation
inline int compare(const edge&) const; inline int compare(const edge& e) const;
//- Compare the given start and end points with this curve //- Compare the given start/end points with this block edge
// Return: // Return:
// - 0: different // - 0: different
// - +1: identical // - +1: identical
@ -211,22 +211,22 @@ public:
//- The point position corresponding to the curve parameter //- The point position corresponding to the curve parameter
// 0 <= lambda <= 1 // 0 <= lambda <= 1
virtual point position(const scalar) const = 0; virtual point position(const scalar lambda) const = 0;
//- The point positions corresponding to the curve parameters //- The point positions corresponding to the curve parameters
// 0 <= lambda <= 1 // 0 <= lambda <= 1
virtual tmp<pointField> position(const scalarList&) const; virtual tmp<pointField> position(const scalarList& lambdas) const;
//- The length of the curve //- The length of the curve
virtual scalar length() const = 0; virtual scalar length() const = 0;
//- Write edge with variable backsubstitution //- Write edge with variable back-substitution
void write(Ostream&, const dictionary&) const; void write(Ostream& os, const dictionary& dict) const;
// Ostream Operator // Ostream Operator
friend Ostream& operator<<(Ostream&, const blockEdge&); friend Ostream& operator<<(Ostream& os, const blockEdge& e);
}; };

View File

@ -74,8 +74,8 @@ Foam::point Foam::blockEdges::lineEdge::position(const scalar lambda) const
#ifdef FULLDEBUG #ifdef FULLDEBUG
if (lambda < -SMALL || lambda > 1 + SMALL) if (lambda < -SMALL || lambda > 1 + SMALL)
{ {
WarningInFunction InfoInFunction
<< "Parameter out of range, lambda = " << lambda << nl; << "Limit parameter to [0-1] range: " << lambda << nl;
} }
#endif #endif

View File

@ -38,15 +38,18 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{
namespace blockEdges
{ {
defineTypeNameAndDebug(projectCurveEdge, 0); defineTypeNameAndDebug(projectCurveEdge, 0);
addToRunTimeSelectionTable(blockEdge, projectCurveEdge, Istream); addToRunTimeSelectionTable(blockEdge, projectCurveEdge, Istream);
} }
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::projectCurveEdge::projectCurveEdge Foam::blockEdges::projectCurveEdge::projectCurveEdge
( (
const dictionary& dict, const dictionary& dict,
const label index, const label index,
@ -84,7 +87,7 @@ Foam::projectCurveEdge::projectCurveEdge
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::point Foam::point
Foam::projectCurveEdge::position(const scalar) const Foam::blockEdges::projectCurveEdge::position(const scalar) const
{ {
NotImplemented; NotImplemented;
return point::max; return point::max;
@ -92,7 +95,7 @@ Foam::projectCurveEdge::position(const scalar) const
Foam::tmp<Foam::pointField> Foam::tmp<Foam::pointField>
Foam::projectCurveEdge::position(const scalarList& lambdas) const Foam::blockEdges::projectCurveEdge::position(const scalarList& lambdas) const
{ {
// For debugging to tag the output // For debugging to tag the output
static label eIter = 0; static label eIter = 0;
@ -267,7 +270,7 @@ Foam::projectCurveEdge::position(const scalarList& lambdas) const
} }
Foam::scalar Foam::projectCurveEdge::length() const Foam::scalar Foam::blockEdges::projectCurveEdge::length() const
{ {
NotImplemented; NotImplemented;
return 1; return 1;

View File

@ -25,7 +25,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class Class
Foam::projectCurveEdge Foam::blockEdges::projectCurveEdge
Description Description
Defines the edge from the projection onto a surface (single surface) Defines the edge from the projection onto a surface (single surface)
@ -36,8 +36,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef projectCurveEdge_H #ifndef blockEdges_projectCurveEdge_H
#define projectCurveEdge_H #define blockEdges_projectCurveEdge_H
#include "blockEdge.H" #include "blockEdge.H"
@ -49,6 +49,9 @@ namespace Foam
// Forward Declarations // Forward Declarations
class pointConstraint; class pointConstraint;
namespace blockEdges
{
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class projectCurveEdge Declaration Class projectCurveEdge Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -116,6 +119,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace blockEdges
} // End namespace Foam } // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -36,15 +36,17 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{
namespace blockEdges
{ {
defineTypeNameAndDebug(projectEdge, 0); defineTypeNameAndDebug(projectEdge, 0);
addToRunTimeSelectionTable(blockEdge, projectEdge, Istream); addToRunTimeSelectionTable(blockEdge, projectEdge, Istream);
} }
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::projectEdge::findNearest void Foam::blockEdges::projectEdge::findNearest
( (
const point& pt, const point& pt,
point& near, point& near,
@ -80,7 +82,7 @@ void Foam::projectEdge::findNearest
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::projectEdge::projectEdge Foam::blockEdges::projectEdge::projectEdge
( (
const dictionary& dict, const dictionary& dict,
const label index, const label index,
@ -110,7 +112,7 @@ Foam::projectEdge::projectEdge
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::point Foam::projectEdge::position(const scalar lambda) const Foam::point Foam::blockEdges::projectEdge::position(const scalar lambda) const
{ {
// Initial guess // Initial guess
const point start(points_[start_] + lambda*(points_[end_]-points_[start_])); const point start(points_[start_] + lambda*(points_[end_]-points_[start_]));
@ -128,7 +130,7 @@ Foam::point Foam::projectEdge::position(const scalar lambda) const
Foam::tmp<Foam::pointField> Foam::tmp<Foam::pointField>
Foam::projectEdge::position(const scalarList& lambdas) const Foam::blockEdges::projectEdge::position(const scalarList& lambdas) const
{ {
// For debugging to tag the output // For debugging to tag the output
static label eIter = 0; static label eIter = 0;
@ -270,7 +272,7 @@ Foam::projectEdge::position(const scalarList& lambdas) const
} }
Foam::scalar Foam::projectEdge::length() const Foam::scalar Foam::blockEdges::projectEdge::length() const
{ {
NotImplemented; NotImplemented;
return 1; return 1;

View File

@ -25,7 +25,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class Class
Foam::projectEdge Foam::blockEdges::projectEdge
Description Description
Defines the edge from the projection onto a surface (single surface) Defines the edge from the projection onto a surface (single surface)
@ -36,8 +36,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef projectEdge_H #ifndef blockEdges_projectEdge_H
#define projectEdge_H #define blockEdges_projectEdge_H
#include "blockEdge.H" #include "blockEdge.H"
@ -49,6 +49,9 @@ namespace Foam
// Forward Declarations // Forward Declarations
class pointConstraint; class pointConstraint;
namespace blockEdges
{
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class projectEdge Declaration Class projectEdge Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -118,6 +121,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace blockEdges
} // End namespace Foam } // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //