Y.h
Go to the documentation of this file.
1 // This file is part of the MercuryDPM project (https://www.mercurydpm.org).
2 // Copyright (c), The MercuryDPM Developers Team. All rights reserved.
3 // License: BSD 3-Clause License; see the LICENSE file in the root directory.
4 
5 #ifndef Y_H
6 #define Y_H
7 
8 #include <GeneralDefine.h>
9 #include <iostream>
10 #include "Math/Vector.h"
11 #include "Base_X_Y_Z.h"
12 #include <vector>
13 #include <array>
14 
15 class BaseParticle;
16 
17 class BaseInteraction;
18 
19 class DPMBase;
20 
21 namespace CGCoordinates
22 {
23 
30 class Y : public Base_X_Y_Z
31 {
32 public:
33 
37  static void writeNames(std::ostream& os);
38 
42  void write(std::ostream& os) const;
43 
48  static Mdouble getVolumeOfAveragedDimensions(const Vec3D& min, const Vec3D& max);
49 
54  Mdouble getDistanceSquared(const Vec3D& p) const;
55 
59  static Mdouble getLength(const Vec3D& p);
60 
65  void setY(Mdouble x);
66 
72  Mdouble getINormal(const BaseInteraction& c, const Vec3D& normal) const;
73 
79  Mdouble getPNormal(const BaseInteraction& c, const Vec3D& normal) const;
80 
86  Mdouble getCNormal(const BaseInteraction& c, const Vec3D& normal) const;
87 
88  static bool isResolvedIn(unsigned i) {return i==1?true:false;}
89 
90  static std::string getName();
91 
92 protected:
93 
98 };
99 
103 template<typename T>
105 spaceEvenly(Vec3D min, Vec3D max, std::vector<std::size_t> nAll, std::vector<T>& points)
106 {
107  std::size_t n = nAll[1];
108  Mdouble delta = (max.Y - min.Y) / n;
109  Mdouble start = min.Y + 0.5 * delta;
110  points.resize(n);
111  for (std::size_t i = 0; i < n; i++)
112  {
113  points[i].coordinates.setY(start + delta * i);
114  }
115 }
116 
117 }
118 #endif
int i
Definition: BiCGSTAB_step_by_step.cpp:9
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
float * p
Definition: Tutorial_Map_using.cpp:9
Stores information about interactions between two interactable objects; often particles but could be ...
Definition: BaseInteraction.h:39
Definition: BaseParticle.h:33
Contains common member functions of the X, Y, and Z classes.
Definition: Base_X_Y_Z.h:29
Defines the non-averaged directions on which spatial coarse-graining is applied (the y- direction for...
Definition: Y.h:31
static bool isResolvedIn(unsigned i)
Definition: Y.h:88
static void writeNames(std::ostream &os)
Writes the coordinate names in human-readable form to an ostream.
Definition: Y.cc:11
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: Y.cc:52
void setY(Mdouble x)
Returns the position of the current CGPoint, in the non-averaged directions.
Definition: Y.cc:27
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: Y.cc:47
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: Y.cc:22
Mdouble getDistanceSquared(const Vec3D &p) const
Returns the square of the distance between the particle p and the current CGPoint,...
Definition: Y.cc:32
static Mdouble getLength(const Vec3D &p)
Returns the length of the input vector in the non-averaged directions.
Definition: Y.cc:42
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: Y.cc:57
Mdouble y_
Definition: Y.h:97
static std::string getName()
Definition: Y.cc:62
void write(std::ostream &os) const
Writes the coordinates in human-readable form to an ostream.
Definition: Y.cc:16
The DPMBase header includes quite a few header files, defining all the handlers, which are essential....
Definition: DPMBase.h:56
Definition: Kernel/Math/Vector.h:30
#define min(a, b)
Definition: datatypes.h:22
#define max(a, b)
Definition: datatypes.h:23
The class in this namespace contain the position of a CGPoint, in the non-averaged directions,...
Definition: Base_X_Y_Z.h:21
std::enable_if< std::is_base_of< CGCoordinates::O, typename T::CoordinatesType >::value, void >::type spaceEvenly(Vec3D min, Vec3D max, std::vector< std::size_t > nAll, std::vector< T > &points)
Definition: O.h:81
squared absolute value
Definition: GlobalFunctions.h:87
int delta
Definition: MultiOpt.py:96
void normal(const Vector< double > &x, Vector< double > &normal)
Definition: free_surface_rotation.cc:65
int c
Definition: calibrate.py:100
type
Definition: compute_granudrum_aor.py:141
void start(const unsigned &i)
(Re-)start i-th timer
Definition: oomph_utilities.cc:243
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286
list x
Definition: plotDoE.py:28