~chris-rogers/maus/emr_mc_digitization

« back to all changes in this revision

Viewing changes to src/legacy/Optics/Tensor.cc

  • Committer: Chris Rogers
  • Date: 2014-04-16 11:48:45 UTC
  • mfrom: (707 merge)
  • mto: This revision was merged to the branch mainline in revision 711.
  • Revision ID: chris.rogers@stfc.ac.uk-20140416114845-h3u3q7pdcxkxvovs
Update to trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
#include "Tensor3.hh"
3
3
 
4
4
/*
5
 
const Squeal Tensor::_outOfRange = Squeal(Squeal::recoverable, "Tensor index out of range",       "Tensor::Tensor");
6
 
const Squeal Tensor::_outOfRank  = Squeal(Squeal::recoverable, "Tensor rank out of range",        "Tensor::Tensor");
7
 
const Squeal Tensor::_lowRank    = Squeal(Squeal::recoverable, "Do not use Tensor for rank <= 3", "Tensor::Tensor");
 
5
const Exception Tensor::_outOfRange = MAUS::Exception(MAUS::Exception::recoverable, "Tensor index out of range",       "Tensor::Tensor");
 
6
const Exception Tensor::_outOfRank  = MAUS::Exception(MAUS::Exception::recoverable, "Tensor rank out of range",        "Tensor::Tensor");
 
7
const Exception Tensor::_lowRank    = MAUS::Exception(MAUS::Exception::recoverable, "Do not use Tensor for rank <= 3", "Tensor::Tensor");
8
8
*/
9
9
 
10
10
Tensor::Tensor(std::vector<int> size, double val) : _data(NULL), _size(size)
34
34
void Tensor::SetTensor(std::vector<int> size, double val)
35
35
{
36
36
        _size = size;
37
 
        if(size.size() < 4) throw( Squeal(Squeal::recoverable, "Do not use Tensor for rank <= 3", "Tensor::Tensor"));
 
37
        if(size.size() < 4) throw(MAUS::Exception(MAUS::Exception::recoverable, "Do not use Tensor for rank <= 3", "Tensor::Tensor"));
38
38
        else if(size.size() == 4)
39
39
        {
40
40
                _data = new Tensor*[size[0]];
185
185
 
186
186
double Tensor::Get(std::vector<int> position) const
187
187
{
188
 
        if(int(position.size()) != GetRank()) throw(Squeal(Squeal::recoverable, "Get rank different to Tensor rank", "Tensor::Get"));
 
188
        if(int(position.size()) != GetRank()) throw(MAUS::Exception(MAUS::Exception::recoverable, "Get rank different to Tensor rank", "Tensor::Get"));
189
189
        const Tensor* val = this;
190
190
        if(GetRank()>3)
191
191
        {