mirror of
https://github.com/OpenFOAM/OpenFOAM-6.git
synced 2025-12-08 06:57:46 +00:00
VectorSpace: Added normalised function
This is useful for creating const unit vectors
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -428,6 +428,17 @@ inline scalar mag
|
||||
}
|
||||
|
||||
|
||||
template<class Form, class Cmpt, direction Ncmpts>
|
||||
inline VectorSpace<Form, Cmpt, Ncmpts> normalised
|
||||
(
|
||||
const VectorSpace<Form, Cmpt, Ncmpts>& vs
|
||||
)
|
||||
{
|
||||
const scalar magVs = mag(vs);
|
||||
return magVs > 0 ? vs/magVs : Zero;
|
||||
}
|
||||
|
||||
|
||||
template<class Form, class Cmpt, direction Ncmpts>
|
||||
inline VectorSpace<Form, Cmpt, Ncmpts> cmptMultiply
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user