XZ.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 XZ_H
6 #define XZ_H
7 
8 #include <GeneralDefine.h>
9 #include <iostream>
10 #include "Math/Vector.h"
11 #include <vector>
12 #include <array>
13 #include "Base_XY_XZ_YZ.h"
14 
15 class BaseParticle;
16 
17 class BaseInteraction;
18 
19 class DPMBase;
20 
21 namespace CGCoordinates
22 {
23 
30 class XZ : public Base_XY_XZ_YZ
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 setXZ(Mdouble x, Mdouble z);
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 
93  Mdouble getTangentialSquared(const BaseInteraction& c, Mdouble pNormal) const;
94 
95  static bool isResolvedIn(unsigned i) {return i==1?false:true;}
96 
97  static std::string getName();
98 
99 protected:
100 
109 };
110 
114 template<typename T>
116 spaceEvenly(Vec3D min, Vec3D max, std::vector<std::size_t> nAll, std::vector<T>& points)
117 {
118  std::size_t n0 = nAll[0];
119  std::size_t n1 = nAll[2];
120  Mdouble delta0 = (max.X - min.X) / n0;
121  Mdouble delta1 = (max.Z - min.Z) / n1;
122  Mdouble start0 = min.X + 0.5 * delta0;
123  Mdouble start1 = min.Z + 0.5 * delta1;
124  points.resize(n0 * n1);
125  for (std::size_t i = 0; i < n0; i++)
126  {
127  for (std::size_t j = 0; j < n1; j++)
128  {
129  points[i * n1 + j].coordinates.setXZ(start0 + delta0 * i, start1 + delta1 * j);
130  }
131  }
132 }
133 
134 }
135 #endif
int i
Definition: BiCGSTAB_step_by_step.cpp:9
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 XY, XZ, and YZ classes.
Definition: Base_XY_XZ_YZ.h:29
Defines the non-averaged directions on which spatial coarse-graining is applied (the x- and z-directi...
Definition: XZ.h:31
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: XZ.cc:66
void write(std::ostream &os) const
Writes the coordinates in human-readable form to an ostream.
Definition: XZ.cc:16
Mdouble getDistanceSquared(const Vec3D &p) const
Returns the square of the distance between the particle p and the current CGPoint,...
Definition: XZ.cc:33
static bool isResolvedIn(unsigned i)
Definition: XZ.h: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: XZ.cc:22
Mdouble z_
Definition: XZ.h:108
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: XZ.cc:48
static std::string getName()
Definition: XZ.cc:73
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: XZ.cc:54
static Mdouble getLength(const Vec3D &p)
Returns the length of the input vector in the non-averaged directions.
Definition: XZ.cc:43
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: XZ.cc:60
void setXZ(Mdouble x, Mdouble z)
Returns the position of the current CGPoint, in the non-averaged directions.
Definition: XZ.cc:27
Mdouble x_
Definition: XZ.h:104
static void writeNames(std::ostream &os)
Writes the coordinate names in human-readable form to an ostream.
Definition: XZ.cc:11
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
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
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286
list x
Definition: plotDoE.py:28
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2