MURE
Loading...
Searching...
No Matches
MathBrick.hxx
Go to the documentation of this file.
1/*
2 This file is part of MURE,
3 Copyright (C) 2007-2021 MURE developers.
4
5 MURE is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 MURE is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with MURE. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19#ifndef _MathBRICK_HXX_
20#define _MathBRICK_HXX_
21
27#include <string>
28#include <algorithm>
29#include <iosfwd>
30#include <vector>
31
32#include "Shape.hxx"
33#include "MathCylinder.hxx"
34#include "MCSource.hxx"
35
36class MathCylinder;
37
38using namespace std;
39
41
57class MathBrick : public Shape
58{
59 public :
65
72 MathBrick(double HalfX = 0.01, double HalfY = 0.01, double HalfZ = 0.01, int Sign = - 1);
73
75
86 MathBrick(double *Origin, double *Ux, double *Uy, double *Uz, double HalfX = 0.01, double HalfY = 0.01, double HalfZ = 0.01, int Sign = - 1);
87
89
96 MathBrick(const char *Infinite, double HalfX = 0.01, double HalfY = 0.01, int Sign = - 1);
97 Shape_ptr Clone(int count = 0) override;
98 void Copy(Shape_ptr B) override;
100
105 unsigned IsBrick() override
106 {
107 return 1;
108 }
109 double GetHalfX()
110 {
111 return fHalfSize[0];
112 }
113 double GetHalfY()
114 {
115 return fHalfSize[1];
116 }
117 double GetHalfZ()
118 {
119 return fHalfSize[2];
120 }
121 vector < double > GetOrigin()
122 {
123 return fOrigin;
124 }
125 vector < double > GetUx()
126 {
127 return fUx;
128 }
129 vector < double > GetUy()
130 {
131 return fUy;
132 }
133 vector < double > GetUz()
134 {
135 return fUz;
136 }
137
139
147 void SetPeriodicBoundary(bool state = true, string TopBottPlaneBC = "mirror") override;
149
155
161 void Translate(double dx, double dy, double dz, int count = 0) override;
163
170 void Rotate(double phi, double theta = 0, double psi = 0, double *center = nullptr, int count = 0) override;
172
177 unsigned IsIncluded(Shape_ptr OtherShape) override;
178 unsigned IsDisjoint(Shape_ptr OtherShape) override;
179
181
185 bool PointInShape(double *P, int border) override;
187
192
199 double MinDistanceFrom2OppositeFace(vector < double > N, int whichplane, double *S);
200
201 void CalculNot() override;
202
204 int NumberOfShapes() override
205 {
206 if(fInfinite) return 4 ;
207 return 6;
208 }
210
211 protected:
212
213 MathBrick(double HalfX, double HalfY, double HalfZ, int Sign, bool Infinite);
214
215 MathBrick *CreateNewInstance(int sign = 1) override;
216
217 void Init(double HalfX, double HalfY, double HalfZ);
219
224 unsigned CornerInBrick(MathBrick *brick, int all, int border);
225
227
232 unsigned CornerInCylinder(MathCylinder *cyl, int all, int border);
233
234 double Dist2Segment(MathCylinder *cyl, double Segment[6][2], double C0[6][2], int &segmentNum);
243 void FindBrickProjection(MathCylinder *cyl, double Segment[6][2], double C0[6][2], double Origin[2]);
244
245 unsigned GeneralIntersectionOf2Brick(MathBrick *brick);
255 unsigned LineCrossPlane(double *X, vector < double > N, double *P, vector < double > U, double *D);
261 unsigned CylinderCrossBrick(MathCylinder *Cyl);
269 unsigned PointInSegment(double *X, double *A, double *B, int border);
270
280 unsigned TwoFaces3Segments(MathBrick *brick, vector < double > N, int whichSize, double *C0, double C1[3][3]);
281
291 unsigned TwoFaces2Segments(MathBrick *brick, vector < double > N, int whichSize, double *C0, double C1[2][3]);
292
293 double GetVirtualSphereRadius() override;
294 double *GetVirtualSphereCenter() override;
295
296
306 double MinDist1Point2Face(vector < double > U0, vector < double > U1, vector < double > U2, double *P0, double *S, int whichplane);
315 double MinDist1Point2FaceInfinite(vector < double > U0, vector < double > U1, double *P0, double *S, int whichplane);
316
317 double fHalfSize[3];
318 vector < double > fOrigin;
319 vector < double > fUx;
320 vector < double > fUy;
321 vector < double > fUz;
322
323};
324
325#endif
#define sign(a)
Definition GenericReactorAssembly.cxx:43
Header file for Monte-Carlo Source abstract class.
Header file for MathCylinder class.
Header file for Shape class and Shape_ptr type.
A rectangular parallepipede box.
Definition MathBrick.hxx:58
double GetHalfZ()
Definition MathBrick.hxx:117
unsigned TwoFaces3Segments(MathBrick *brick, vector< double > N, int whichSize, double *C0, double C1[3][3])
Definition MathBrick.cxx:1046
unsigned TwoFaces2Segments(MathBrick *brick, vector< double > N, int whichSize, double *C0, double C1[2][3])
Definition MathBrick.cxx:1070
double fHalfSize[3]
Half sizes of the brick.
Definition MathBrick.hxx:317
bool PointInShape(double *P, int border) override
True if the point P is in the Shape.
Definition MathBrick.cxx:922
void FindBrickProjection(MathCylinder *cyl, double Segment[6][2], double C0[6][2], double Origin[2])
Definition MathBrick.cxx:1339
void SetPeriodicBoundary(bool state=true, string TopBottPlaneBC="mirror") override
Periodic boundary (WARNING: only for MathBrick and MathHexagon).
Definition MathBrick.cxx:1454
double Dist2Segment(MathCylinder *cyl, double Segment[6][2], double C0[6][2], int &segmentNum)
Definition MathBrick.cxx:1426
unsigned IsDisjoint(Shape_ptr OtherShape) override
return 1 if the MathBrick is disjoint of OtherShape otherwise 0
Definition MathBrick.cxx:467
double GetHalfY()
Definition MathBrick.hxx:113
unsigned PointInSegment(double *X, double *A, double *B, int border)
Definition MathBrick.cxx:964
double GetHalfX()
Definition MathBrick.hxx:109
double * GetVirtualSphereCenter() override
returns the center of a Sphere containing the Shape
Definition MathBrick.cxx:1649
void Copy(Shape_ptr B) override
Copy all attributes of a Shape (but not attributes of the ancestor classes).
Definition MathBrick.cxx:1503
double GetVirtualSphereRadius() override
returns the radius of a Sphere containing the Shape
Definition MathBrick.cxx:1531
int NumberOfShapes() override
Number of shapes/surfaces this shape consists of.
Definition MathBrick.hxx:204
unsigned LineCrossPlane(double *X, vector< double > N, double *P, vector< double > U, double *D)
Definition MathBrick.cxx:986
vector< double > fUz
Normal vector to the 2 Z planes.
Definition MathBrick.hxx:321
vector< double > GetUx()
Definition MathBrick.hxx:125
unsigned GeneralIntersectionOf2Brick(MathBrick *brick)
return 1 if there is an intersection of the segment of this with the MathBrick brick
Definition MathBrick.cxx:1148
unsigned IsIncluded(Shape_ptr OtherShape) override
return 1 if the MathBrick is included in OtherShape otherwise 0
Definition MathBrick.cxx:140
Shape_ptr Clone(int count=0) override
Clone a Shape.
Definition MathBrick.cxx:1463
void Translate(double dx, double dy, double dz, int count=0) override
Translate the Shape by (dx, dy, dz).
Definition MathBrick.cxx:888
unsigned CornerInBrick(MathBrick *brick, int all, int border)
Return 1 if corner(s) of this shape are in a brick.
Definition MathBrick.cxx:1282
vector< double > fOrigin
Origin of the brick.
Definition MathBrick.hxx:318
void CalculNot() override
Allocates and calculs the complement of a brick.
Definition MathBrick.cxx:862
MathBrick * CreateNewInstance(int sign=1) override
a new MathBrick instance.
Definition MathBrick.cxx:1641
vector< double > fUy
Normal vector to the 2 Y planes.
Definition MathBrick.hxx:320
vector< double > fUx
Normal vector to the 2 X planes.
Definition MathBrick.hxx:319
vector< double > GetOrigin()
Definition MathBrick.hxx:121
double MinDist1Point2Face(vector< double > U0, vector< double > U1, vector< double > U2, double *P0, double *S, int whichplane)
Definition MathBrick.cxx:1541
double MinDistanceFrom2OppositeFace(vector< double > N, int whichplane, double *S)
Definition MathBrick.cxx:1094
unsigned CornerInCylinder(MathCylinder *cyl, int all, int border)
Return 1 if corner(s) of this shape are in a cylinder.
Definition MathBrick.cxx:1309
void Rotate(double phi, double theta=0, double psi=0, double *center=nullptr, int count=0) override
Rotate the Shape clockwise.
Definition MathBrick.cxx:904
vector< double > GetUy()
Definition MathBrick.hxx:129
unsigned CylinderCrossBrick(MathCylinder *Cyl)
Definition MathBrick.cxx:1006
vector< double > GetUz()
Definition MathBrick.hxx:133
double MinDist1Point2FaceInfinite(vector< double > U0, vector< double > U1, double *P0, double *S, int whichplane)
Definition MathBrick.cxx:1613
unsigned IsBrick() override
Definition MathBrick.hxx:105
void Init(double HalfX, double HalfY, double HalfZ)
Definition MathBrick.cxx:118
Infinite cylinder Shape.
Definition MathCylinder.hxx:47
Abstract class to define geometrical shapes.
Definition Shape.hxx:85
bool fInfinite
Determines whether the shape is infinite or not.
Definition Shape.hxx:549
the namespace of the Standard C++

MURE Project, documentation generated by Doxygen 1.9.7 - Fri Jan 19 2024