~mbogomilov/maus/devel3

« back to all changes in this revision

Viewing changes to src/legacy/Interface/TriangularMesh.cc

  • Committer: Durga Rajaram
  • Date: 2014-01-14 07:07:02 UTC
  • mfrom: (659.1.80 relcand)
  • Revision ID: durga@fnal.gov-20140114070702-2l1fuj1w6rraw7xe
Tags: MAUS-v0.7.6
MAUS-v0.7.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
// MAUS WARNING: THIS IS LEGACY CODE.
2
2
#include "Interface/TriangularMesh.hh"
3
 
#include "Interface/Squeal.hh"
 
3
#include "Utils/Exception.hh"
4
4
 
5
5
#include <iostream>
6
6
#include <fstream>
24
24
                for(int i=0; i<numberOfPoints; i++) AddPoint_Delaunay(thePoints[i]);
25
25
        }
26
26
        else
27
 
                throw(Squeal(Squeal::recoverable, "TriangularMesh only implemented for 2d", "TriangularMesh::TriangularMesh(...)"));
 
27
                throw(MAUS::Exception(MAUS::Exception::recoverable, "TriangularMesh only implemented for 2d", "TriangularMesh::TriangularMesh(...)"));
28
28
}
29
29
 
30
30
TriangularMesh::~TriangularMesh() 
56
56
                for(int j=0; j<nDims; j++)
57
57
                        fin >> points[i]->coords[j];
58
58
        }
59
 
        if(!fin) throw(Squeal(Squeal::recoverable, "Error reading file", "QHullIO::ReadQHullInputFile"));
 
59
        if(!fin) throw(MAUS::Exception(MAUS::Exception::recoverable, "Error reading file", "QHullIO::ReadQHullInputFile"));
60
60
        fin.close();
61
61
}
62
62
 
81
81
                }
82
82
                simplices.push_back(new Simplex(this, simplexPoints));
83
83
        }
84
 
        if(!fin) throw(Squeal(Squeal::recoverable, "Error reading file", "QHullIO::ReadQHullInputFile"));
 
84
        if(!fin) throw(MAUS::Exception(MAUS::Exception::recoverable, "Error reading file", "QHullIO::ReadQHullInputFile"));
85
85
        fin.close();
86
86
}
87
87
 
96
96
                        fout << points[i]->coords[j] << " ";
97
97
                fout << "\n";
98
98
        }
99
 
        if(!fout) throw(Squeal(Squeal::recoverable, "Error writing file", "TriangularMesh::WriteQHullInput"));
 
99
        if(!fout) throw(MAUS::Exception(MAUS::Exception::recoverable, "Error writing file", "TriangularMesh::WriteQHullInput"));
100
100
        fout.close();
101
101
}
102
102
 
137
137
                hulls[i] = new Hull(this, myHullPoints, NULL);
138
138
        }
139
139
        
140
 
        if(!fin) throw(Squeal(Squeal::recoverable, "Error reading file", "QHullIO::ReadQHullInputFile"));
 
140
        if(!fin) throw(MAUS::Exception(MAUS::Exception::recoverable, "Error reading file", "QHullIO::ReadQHullInputFile"));
141
141
        fin.close();
142
142
}
143
143
 
314
314
        if(IsLeaf()) return *this;
315
315
        for(std::list<Simplex*>::const_iterator it = f_children.begin(); it!=f_children.end(); ++it)
316
316
                if( (*it)->IsInside(test) ) return (*it)->FindLeaf(test);
317
 
        throw(Squeal(Squeal::recoverable, "Failed to find test point", "Simplex::FindLeaf"));
 
317
        throw(MAUS::Exception(MAUS::Exception::recoverable, "Failed to find test point", "Simplex::FindLeaf"));
318
318
}
319
319
 
320
320
bool TriangularMesh::Simplex::IsInside(Point& test) const
367
367
        if     (apexInt == 0) {end0 = f_point[1]; end1 = f_point[2];}
368
368
        else if(apexInt == 1) {end0 = f_point[0]; end1 = f_point[2];}
369
369
        else if(apexInt == 2) {end0 = f_point[0]; end1 = f_point[1];}
370
 
        else throw(Squeal(Squeal::recoverable, "Trying to find BarycentricCoordinates with point not in Simplex", "Simplex::BarycentricCoordinates"));
 
370
        else throw(MAUS::Exception(MAUS::Exception::recoverable, "Trying to find BarycentricCoordinates with point not in Simplex", "Simplex::BarycentricCoordinates"));
371
371
        TriangularMesh::BarycentricCoordinates(test, apex, *end0, *end1, barys);
372
372
}
373
373