Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
openfoam
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Development
openfoam
Commits
3e505614
Commit
3e505614
authored
4 years ago
by
Andrew Heather
Committed by
Mattijs Janssens
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
ENH: Vector2D - added isClose function
parent
b8768e28
No related branches found
No related tags found
1 merge request
!468
AMI improvements
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/OpenFOAM/primitives/Vector2D/Vector2D.H
+7
-2
7 additions, 2 deletions
src/OpenFOAM/primitives/Vector2D/Vector2D.H
src/OpenFOAM/primitives/Vector2D/Vector2DI.H
+12
-1
12 additions, 1 deletion
src/OpenFOAM/primitives/Vector2D/Vector2DI.H
with
19 additions
and
3 deletions
src/OpenFOAM/primitives/Vector2D/Vector2D.H
+
7
−
2
View file @
3e505614
...
...
@@ -116,13 +116,18 @@ public:
//- Access to the vector y component
inline
Cmpt
&
y
();
//- Normalise the vector by its magnitude
inline
Vector2D
<
Cmpt
>&
normalise
();
//- Perp dot product (dot product with perpendicular vector)
inline
scalar
perp
(
const
Vector2D
<
Cmpt
>&
b
)
const
;
//- Return true if vector is within tol
inline
bool
isClose
(
const
Vector2D
<
Cmpt
>&
b
,
const
scalar
tol
=
1e-10
)
const
;
};
...
...
This diff is collapsed.
Click to expand it.
src/OpenFOAM/primitives/Vector2D/Vector2DI.H
+
12
−
1
View file @
3e505614
...
...
@@ -126,7 +126,18 @@ operator&(const Vector2D<Cmpt>& v1, const Vector2D<Cmpt>& v2)
template
<
class
Cmpt
>
inline
scalar
Vector2D
<
Cmpt
>::
perp
(
const
Vector2D
<
Cmpt
>&
b
)
const
{
return
x
()
*
b
.
y
()
-
y
()
*
b
.
x
();
return
x
()
*
b
.
y
()
-
y
()
*
b
.
x
();
}
template
<
class
Cmpt
>
inline
bool
Vector2D
<
Cmpt
>::
isClose
(
const
Vector2D
<
Cmpt
>&
b
,
const
scalar
tol
)
const
{
return
(
mag
(
x
()
-
b
.
x
())
<
tol
&&
mag
(
y
()
-
b
.
y
())
<
tol
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment