Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@21339 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
- Loading branch information
1 parent
7f0b6a3
commit 0910073
Showing
1 changed file
with
56 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,56 @@ | ||
#pragma once | ||
|
||
//#include <map> | ||
//#include <vector> | ||
#include "Modelica.h" | ||
//#include <stdexcept> | ||
|
||
#ifdef USE_UMFPACK | ||
#include "umfpack.h" | ||
|
||
using std::map; | ||
using std::pair; | ||
using std::make_pair; | ||
|
||
struct sparse_inserter { | ||
struct t2 { | ||
int i; | ||
int j; | ||
map< pair<int,int>, double> & content; | ||
t2(int i, int j, map< pair<int,int>, double> & c): i(i), j(j), content(c) {} | ||
void operator=(double t) { | ||
content[make_pair(j,i)]=t; | ||
} | ||
}; | ||
|
||
struct t1 { | ||
int i; | ||
map< pair<int,int>, double> & content; | ||
t1(int i,map< pair<int,int>, double> & c): i(i), content(c) {} | ||
t2 operator[](size_t j) { | ||
t2 res(i,j,content); | ||
return res; | ||
} | ||
}; | ||
|
||
|
||
map< pair<int,int>, double> content; | ||
t1 operator[](size_t i) { | ||
t1 res(i,content); | ||
return res; | ||
} | ||
|
||
}; | ||
|
||
struct sparse_matrix { | ||
std::vector<int> Ap; | ||
std::vector<int> Ai; | ||
std::vector<double> Ax; | ||
int n; | ||
sparse_matrix(int n=-1): n(n) {} | ||
|
||
void build(sparse_inserter& ins); | ||
int solve(const double* b,double* x); | ||
}; | ||
|
||
#endif | ||
#pragma once | ||
|
||
//#include <map> | ||
//#include <vector> | ||
#include "Modelica.h" | ||
//#include <stdexcept> | ||
|
||
#ifdef USE_UMFPACK | ||
#include "umfpack.h" | ||
|
||
using std::map; | ||
using std::pair; | ||
using std::make_pair; | ||
|
||
struct sparse_inserter { | ||
struct t2 { | ||
int i; | ||
int j; | ||
map< pair<int,int>, double> & content; | ||
t2(int i, int j, map< pair<int,int>, double> & c): i(i), j(j), content(c) {} | ||
void operator=(double t) { | ||
content[make_pair(j,i)]=t; | ||
} | ||
}; | ||
|
||
struct t1 { | ||
int i; | ||
map< pair<int,int>, double> & content; | ||
t1(int i,map< pair<int,int>, double> & c): i(i), content(c) {} | ||
t2 operator[](size_t j) { | ||
t2 res(i,j,content); | ||
return res; | ||
} | ||
}; | ||
|
||
|
||
map< pair<int,int>, double> content; | ||
t1 operator[](size_t i) { | ||
t1 res(i,content); | ||
return res; | ||
} | ||
|
||
}; | ||
|
||
struct sparse_matrix { | ||
std::vector<int> Ap; | ||
std::vector<int> Ai; | ||
std::vector<double> Ax; | ||
int n; | ||
sparse_matrix(int n=-1): n(n) {} | ||
|
||
void build(sparse_inserter& ins); | ||
int solve(const double* b,double* x); | ||
}; | ||
|
||
#endif |