X.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 X_H
6 #define X_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 X : 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 setX(Mdouble x);
66 
67  Mdouble getX() const;
68 
74  Mdouble getINormal(const BaseInteraction& c, const Vec3D& normal) const;
75 
81  Mdouble getPNormal(const BaseInteraction& c, const Vec3D& normal) const;
82 
88  Mdouble getCNormal(const BaseInteraction& c, const Vec3D& normal) const;
89 
90  static bool isResolvedIn(unsigned i) {return i==0?true:false;}
91 
92  static std::string getName();
93 
94 protected:
95 
100 };
101 
105 template<typename T>
107 spaceEvenly(Vec3D min, Vec3D max, std::vector<std::size_t> nAll, std::vector<T>& points)
108 {
109  std::size_t n = nAll[0];
110  Mdouble delta = (max.X - min.X) / n;
111  Mdouble start = min.X + 0.5 * delta;
112  points.resize(n);
113  for (std::size_t i = 0; i < n; i++)
114  {
115  points[i].coordinates.setX(start + delta * i);
116  }
117 }
118 
119 }
120 #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 x-direction for ...
Definition: X.h:31
Mdouble x_
Definition: X.h:99
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:59
static std::string getName()
Definition: X.cc:69
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:64
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:23
Mdouble getX() const
Definition: X.cc:33
static Mdouble getLength(const Vec3D &p)
Returns the length of the input vector in the non-averaged directions.
Definition: X.cc:48
void write(std::ostream &os) const
Writes the coordinates in human-readable form to an ostream.
Definition: X.cc:16
static void writeNames(std::ostream &os)
Writes the coordinate names in human-readable form to an ostream.
Definition: X.cc:11
void setX(Mdouble x)
Returns the position of the current CGPoint, in the non-averaged directions.
Definition: X.cc:28
Mdouble getDistanceSquared(const Vec3D &p) const
Returns the square of the distance between the particle p and the current CGPoint,...
Definition: X.cc:39
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:54
static bool isResolvedIn(unsigned i)
Definition: X.h:90
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