MercuryDPM  Trunk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
X.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 "X.h"
27 #include "Particles/BaseParticle.h"
28 #include "DPMBase.h"
29 
30 using namespace CGCoordinates;
31 
32 void X::writeNames(std::ostream& os)
33 {
34  os << "x ";
35 }
36 
37 void X::write(std::ostream& os) const
38 {
39  os << x_ << ' ';
40 }
41 
43 
45 {
46  return (max.Y - min.Y) * (max.Z - min.Z);
47 }
48 
50 {
51  x_ = x;
52 }
53 
55 {
56  return x_;
57 }
58 
59 
61 {
62  return mathsFunc::square(p.X - x_);
63 }
64 
70 {
71  return fabs(p.X);
72 }
73 
75 Mdouble X::getINormal(const BaseInteraction& c, const Vec3D& normal) const
76 {
77  return (c.getI()->getPosition().X - x_) * normal.X;
78 }
79 
80 Mdouble X::getPNormal(const BaseInteraction& c, const Vec3D& normal) const
81 {
82  return (c.getP()->getPosition().X - x_) * normal.X;
83 }
84 
85 Mdouble X::getCNormal(const BaseInteraction& c, const Vec3D& normal) const
86 {
87  return (c.getContactPoint().X - x_) * normal.X;
88 }
89 
90 std::string X::getName()
91 {
92  return "X";
93 }
94 
static void writeNames(std::ostream &os)
Writes the coordinate names in human-readable form to an ostream.
Definition: X.cc:32
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
Mdouble X
the vector components
Definition: Vector.h:65
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: X.cc:85
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: X.cc:44
Mdouble getX() const
Definition: X.cc:54
void write(std::ostream &os) const
Writes the coordinates in human-readable form to an ostream.
Definition: X.cc:37
double Mdouble
Definition: GeneralDefine.h:34
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: X.cc:60
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 ...
void setX(Mdouble x)
Returns the position of the current CGPoint, in the non-averaged directions.
Definition: X.cc:49
BaseInteractable * getP()
Returns a pointer to first object involved in the interaction (normally a particle).
static std::string getName()
Definition: X.cc:90
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: X.cc:75
Mdouble Y
Definition: Vector.h:65
static Mdouble getLength(const Vec3D &p)
Returns the length of the input vector in the non-averaged directions.
Definition: X.cc:69
Definition: Vector.h:49
T square(const T val)
squares a number
Definition: ExtendedMath.h:104
Mdouble Z
Definition: Vector.h:65
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: X.cc:80
Mdouble x_
Definition: X.h:119