Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4GDMLMatrix Class Reference

#include <G4GDMLReadDefine.hh>

Public Member Functions

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

Detailed Description

Definition at line 47 of file G4GDMLReadDefine.hh.

Constructor & Destructor Documentation

G4GDMLMatrix::G4GDMLMatrix ( )

Definition at line 37 of file G4GDMLReadDefine.cc.

38  : m(0), rows(0), cols(0)
39 {
40 }
G4GDMLMatrix::G4GDMLMatrix ( size_t  rows0,
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 indeces as arguments!?");
48  }
49  rows = rows0;
50  cols = cols0;
51  m = new G4double[rows*cols];
52 }
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

G4GDMLMatrix::G4GDMLMatrix ( const G4GDMLMatrix rhs)

Definition at line 54 of file G4GDMLReadDefine.cc.

55  : m(0), rows(0), cols(0)
56 {
57  if (rhs.m)
58  {
59  rows = rhs.rows;
60  cols = rhs.cols;
61  m = new G4double[rows*cols];
62  for (size_t i=0; i<rows*cols; i++) { m[i] = rhs.m[i]; }
63  }
64 }
double G4double
Definition: G4Types.hh:76
G4GDMLMatrix::~G4GDMLMatrix ( )

Definition at line 89 of file G4GDMLReadDefine.cc.

90 {
91  delete [] m;
92 }

Member Function Documentation

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

Definition at line 104 of file G4GDMLReadDefine.cc.

105 {
106  if (r>=rows || c>=cols)
107  {
108  G4Exception("G4GDMLMatrix::get()", "InvalidSetup",
109  FatalException, "Index out of range!");
110  }
111  return m[cols*r+c];
112 }
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

Here is the call graph for this function:

Here is the caller graph for this function:

size_t G4GDMLMatrix::GetCols ( ) const

Definition at line 119 of file G4GDMLReadDefine.cc.

120 {
121  return cols;
122 }

Here is the caller graph for this function:

size_t G4GDMLMatrix::GetRows ( ) const

Definition at line 114 of file G4GDMLReadDefine.cc.

115 {
116  return rows;
117 }

Here is the caller graph for this function:

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

Definition at line 66 of file G4GDMLReadDefine.cc.

67 {
68  // Check assignment to self
69  //
70  if (this == &rhs) { return *this; }
71 
72  // Copy data
73  //
74  rows = rhs.rows;
75  cols = rhs.cols;
76  if (rhs.m)
77  {
78  m = new G4double[rows*cols];
79  for (size_t i=0; i<rows*cols; i++) { m[i] = rhs.m[i]; }
80  }
81  else
82  {
83  m = 0;
84  }
85 
86  return *this;
87 }
double G4double
Definition: G4Types.hh:76
void G4GDMLMatrix::Set ( size_t  r,
size_t  c,
G4double  a 
)

Definition at line 94 of file G4GDMLReadDefine.cc.

95 {
96  if (r>=rows || c>=cols)
97  {
98  G4Exception("G4GDMLMatrix::set()", "InvalidSetup",
99  FatalException, "Index out of range!");
100  }
101  m[cols*r+c] = a;
102 }
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

Here is the call graph for this function:

Here is the caller graph for this function:


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