MercuryDPM  Trunk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
YZ.cc
Go to the documentation of this file.
1 //Copyright (c) 2013-2020, The MercuryDPM Developers Team. All rights reserved.
2 //For the list of developers, see <http://www.MercuryDPM.org/Team>.
3 //
4 //Redistribution and use in source and binary forms, with or without
5 //modification, are permitted provided that the following conditions are met:
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above copyright
9 // notice, this list of conditions and the following disclaimer in the
10 // documentation and/or other materials provided with the distribution.
11 // * Neither the name MercuryDPM nor the
12 // names of its contributors may be used to endorse or promote products
13 // derived from this software without specific prior written permission.
14 //
15 //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 //ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 //WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 //DISCLAIMED. IN NO EVENT SHALL THE MERCURYDPM DEVELOPERS TEAM BE LIABLE FOR ANY
19 //DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 //(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 //LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 //ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 //(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 //SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 
26 #include "YZ.h"
27 #include "Particles/BaseParticle.h"
28 #include "DPMBase.h"
29 
30 using namespace CGCoordinates;
31 
32 void YZ::writeNames(std::ostream& os)
33 {
34  os << "y z ";
35 }
36 
37 void YZ::write(std::ostream& os) const
38 {
39  os << y_ << ' ' << z_ << ' ';
40 }
41 
43 
45 {
46  return (max.X - min.X);
47 }
48 
50 {
51  y_ = y;
52  z_ = z;
53 }
54 
56 {
57  return mathsFunc::square(p.Y - y_) + mathsFunc::square(p.Z - z_);
58 }
59 
66 {
67  return sqrt(p.Y * p.Y + p.Z * p.Z);
68 }
69 
70 Mdouble YZ::getINormal(const BaseInteraction& c, const Vec3D& normal) const
71 {
72  return (c.getI()->getPosition().Y - y_) * normal.Y
73  + (c.getI()->getPosition().Z - z_) * normal.Z;
74 }
75 
76 Mdouble YZ::getPNormal(const BaseInteraction& c, const Vec3D& normal) const
77 {
78  return (c.getP()->getPosition().Y - y_) * normal.Y
79  + (c.getP()->getPosition().Z - z_) * normal.Z;
80 }
81 
82 Mdouble YZ::getCNormal(const BaseInteraction& c, const Vec3D& normal) const
83 {
84  return (c.getContactPoint().Y - y_) * normal.Y
85  + (c.getContactPoint().Z - z_) * normal.Z;
86 }
87 
89 {
90  return mathsFunc::square(c.getP()->getPosition().Y - y_)
92  - mathsFunc::square(pNormal);
93 }
94 
95 std::string YZ::getName()
96 {
97  return "YZ";
98 }
Mdouble getCNormal(const BaseInteraction &c, const Vec3D &normal) const
For the Interaction between particles/walls P and I, this function returns the dot product between th...
Definition: YZ.cc:82
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
Mdouble X
the vector components
Definition: Vector.h:65
Mdouble y_
Definition: YZ.h:124
double Mdouble
Definition: GeneralDefine.h:34
void write(std::ostream &os) const
Writes the coordinates in human-readable form to an ostream.
Definition: YZ.cc:37
static Mdouble getLength(const Vec3D &p)
Returns the length of the input vector in the non-averaged directions.
Definition: YZ.cc:65
const Vec3D & getContactPoint() const
Gets constant reference to contact point (vector).
BaseInteractable * getI()
Returns a pointer to the second object involved in the interaction (often a wall or a particle)...
Stores information about interactions between two interactable objects; often particles but could be ...
BaseInteractable * getP()
Returns a pointer to first object involved in the interaction (normally a particle).
Mdouble getDistanceSquared(const Vec3D &p) const
Returns the square of the distance between the particle p and the current CGPoint, in the non-averaged directions.
Definition: YZ.cc:55
Mdouble getPNormal(const BaseInteraction &c, const Vec3D &normal) const
For the Interaction between particles/walls P and I, this function returns the dot product between th...
Definition: YZ.cc:76
Mdouble getTangentialSquared(const BaseInteraction &c, Mdouble pNormal) const
For the Interaction between particles/walls P and I, this function returns the square of the minimum ...
Definition: YZ.cc:88
Mdouble z_
Definition: YZ.h:128
Mdouble Y
Definition: Vector.h:65
Mdouble getINormal(const BaseInteraction &c, const Vec3D &normal) const
For the Interaction between particles/walls P and I, this function returns the dot product between th...
Definition: YZ.cc:70
Definition: Vector.h:49
T square(const T val)
squares a number
Definition: ExtendedMath.h:104
Mdouble Z
Definition: Vector.h:65
void setYZ(Mdouble y, Mdouble z)
Returns the position of the current CGPoint, in the non-averaged directions.
Definition: YZ.cc:49
static void writeNames(std::ostream &os)
Writes the coordinate names in human-readable form to an ostream.
Definition: YZ.cc:32
static std::string getName()
Definition: YZ.cc:95
static Mdouble getVolumeOfAveragedDimensions(const Vec3D &min, const Vec3D &max)
returns the factor the CGFunction has to be divided by, due to integrating the variables over the ave...
Definition: YZ.cc:44