Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4GDMLMatrix Class Reference

#include <G4GDMLReadDefine.hh>

Public Member Functions

 G4GDMLMatrix ()
 
 G4GDMLMatrix (std::size_t rows0, std::size_t cols0)
 
 G4GDMLMatrix (const G4GDMLMatrix &rhs)
 
G4GDMLMatrixoperator= (const G4GDMLMatrix &rhs)
 
 ~G4GDMLMatrix ()
 
void Set (std::size_t r, std::size_t c, G4double a)
 
G4double Get (std::size_t r, std::size_t c) const
 
std::size_t GetRows () const
 
std::size_t GetCols () const
 

Detailed Description

Definition at line 45 of file G4GDMLReadDefine.hh.

Constructor & Destructor Documentation

◆ G4GDMLMatrix() [1/3]

G4GDMLMatrix::G4GDMLMatrix ( )

Definition at line 37 of file G4GDMLReadDefine.cc.

38{
39}

◆ G4GDMLMatrix() [2/3]

G4GDMLMatrix::G4GDMLMatrix ( std::size_t rows0,
std::size_t cols0 )

Definition at line 42 of file G4GDMLReadDefine.cc.

43{
44 if((rows0 == 0) || (cols0 == 0))
45 {
46 G4Exception("G4GDMLMatrix::G4GDMLMatrix(r,c)", "InvalidSetup",
47 FatalException, "Zero indices as arguments!?");
48 }
49 rows = rows0;
50 cols = cols0;
51 m = new G4double[rows * cols];
52}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
double G4double
Definition G4Types.hh:83

◆ G4GDMLMatrix() [3/3]

G4GDMLMatrix::G4GDMLMatrix ( const G4GDMLMatrix & rhs)

Definition at line 55 of file G4GDMLReadDefine.cc.

56{
57 if(rhs.m)
58 {
59 rows = rhs.rows;
60 cols = rhs.cols;
61 m = new G4double[rows * cols];
62 for(std::size_t i = 0; i < rows * cols; ++i)
63 {
64 m[i] = rhs.m[i];
65 }
66 }
67}

◆ ~G4GDMLMatrix()

G4GDMLMatrix::~G4GDMLMatrix ( )

Definition at line 100 of file G4GDMLReadDefine.cc.

101{
102 delete[] m;
103}

Member Function Documentation

◆ Get()

G4double G4GDMLMatrix::Get ( std::size_t r,
std::size_t c ) const

Definition at line 117 of file G4GDMLReadDefine.cc.

118{
119 if(r >= rows || c >= cols)
120 {
121 G4Exception("G4GDMLMatrix::get()", "InvalidSetup", FatalException,
122 "Index out of range!");
123 }
124 return m[cols * r + c];
125}

Referenced by G4GDMLReadMaterials::PropertyRead(), and G4GDMLReadSolids::PropertyRead().

◆ GetCols()

std::size_t G4GDMLMatrix::GetCols ( ) const

Definition at line 134 of file G4GDMLReadDefine.cc.

135{
136 return cols;
137}

Referenced by G4GDMLReadMaterials::PropertyRead(), and G4GDMLReadSolids::PropertyRead().

◆ GetRows()

std::size_t G4GDMLMatrix::GetRows ( ) const

Definition at line 128 of file G4GDMLReadDefine.cc.

129{
130 return rows;
131}

Referenced by G4GDMLReadMaterials::PropertyRead(), and G4GDMLReadSolids::PropertyRead().

◆ operator=()

G4GDMLMatrix & G4GDMLMatrix::operator= ( const G4GDMLMatrix & rhs)

Definition at line 70 of file G4GDMLReadDefine.cc.

71{
72 // Check assignment to self
73 //
74 if(this == &rhs)
75 {
76 return *this;
77 }
78
79 // Copy data
80 //
81 rows = rhs.rows;
82 cols = rhs.cols;
83 if(rhs.m)
84 {
85 m = new G4double[rows * cols];
86 for(std::size_t i = 0; i < rows * cols; ++i)
87 {
88 m[i] = rhs.m[i];
89 }
90 }
91 else
92 {
93 m = nullptr;
94 }
95
96 return *this;
97}

◆ Set()

void G4GDMLMatrix::Set ( std::size_t r,
std::size_t c,
G4double a )

Definition at line 106 of file G4GDMLReadDefine.cc.

107{
108 if(r >= rows || c >= cols)
109 {
110 G4Exception("G4GDMLMatrix::set()", "InvalidSetup", FatalException,
111 "Index out of range!");
112 }
113 m[cols * r + c] = a;
114}

Referenced by G4GDMLReadDefine::MatrixRead().


The documentation for this class was generated from the following files: