mirror of https://github.com/CGAL/cgal
Do not copy matrices but use const&
This commit is contained in:
parent
6f324d4680
commit
01b95347fc
|
|
@ -124,12 +124,12 @@ namespace Heat_method_3 {
|
||||||
* add `vd` to the source set, returning `false` if `vd` is already in the set.
|
* add `vd` to the source set, returning `false` if `vd` is already in the set.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Matrix get_mass_matrix()
|
const Matrix& get_mass_matrix()
|
||||||
{
|
{
|
||||||
return mass_matrix;
|
return mass_matrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
Matrix get_cotan_matrix()
|
const Matrix& get_cotan_matrix()
|
||||||
{
|
{
|
||||||
return cotan_matrix;
|
return cotan_matrix;
|
||||||
}
|
}
|
||||||
|
|
@ -158,7 +158,7 @@ namespace Heat_method_3 {
|
||||||
/**
|
/**
|
||||||
*return current source set
|
*return current source set
|
||||||
*/
|
*/
|
||||||
std::set<vertex_descriptor> get_sources()
|
const std::set<vertex_descriptor>& get_sources()
|
||||||
{
|
{
|
||||||
return sources;
|
return sources;
|
||||||
}
|
}
|
||||||
|
|
@ -188,7 +188,7 @@ namespace Heat_method_3 {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get distance from the current source set to a vertex ` vd`.
|
* get distance from the current source set to a vertex `vd`.
|
||||||
*/
|
*/
|
||||||
double distance(vertex_descriptor vd)
|
double distance(vertex_descriptor vd)
|
||||||
{
|
{
|
||||||
|
|
@ -219,7 +219,7 @@ namespace Heat_method_3 {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Matrix get_kronecker_delta()
|
const Matrix& get_kronecker_delta()
|
||||||
{
|
{
|
||||||
return kronecker;
|
return kronecker;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,8 +43,8 @@ int main()
|
||||||
assert(!(hm.add_source(source)));
|
assert(!(hm.add_source(source)));
|
||||||
assert(hm.remove_source(*(std::next(vertices(sm).first,3))));
|
assert(hm.remove_source(*(std::next(vertices(sm).first,3))));
|
||||||
//cotan matrix tests
|
//cotan matrix tests
|
||||||
SparseMatrix M = hm.get_mass_matrix();
|
const SparseMatrix& M = hm.get_mass_matrix();
|
||||||
SparseMatrix c = hm.get_cotan_matrix();
|
const SparseMatrix& c = hm.get_cotan_matrix();
|
||||||
double sum = 0;
|
double sum = 0;
|
||||||
for(int k = 0; k<c.outerSize(); ++k)
|
for(int k = 0; k<c.outerSize(); ++k)
|
||||||
{
|
{
|
||||||
|
|
@ -75,7 +75,7 @@ int main()
|
||||||
|
|
||||||
//mass matrix tests
|
//mass matrix tests
|
||||||
|
|
||||||
SparseMatrix K = hm.get_kronecker_delta();
|
const SparseMatrix& K = hm.get_kronecker_delta();
|
||||||
assert(K.nonZeros()==1);
|
assert(K.nonZeros()==1);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue