use.cpp 1.46 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include "AMDiS.h"
#include "dlfcn.h"
#include "PluginProvider.h"
#include <iostream>

using namespace AMDiS;
using namespace std;

//typedef OEMSolverCreator* Creator();
//typedef void Remover(OEMSolverCreator*);

int main(int argc, char** argv) {
/*	void* umfpackLib=dlopen("./libamdis-umfpack.so", RTLD_LAZY);
	if (!umfpackLib) {
	        cerr << "Cannot load library: " << dlerror() << '\n';
        	return 1;
	}
	dlerror();

	Creator* creator=(Creator*) (dlsym(umfpackLib, "createSolverCreator"));
	if(creator == NULL) {
		cerr << "could not load the create function in libumfpack.so \n";
		return 2;
	}

	Remover* remover=(Remover* )(dlsym(umfpackLib, "removeSolverCreator"));
	if( remover == NULL) {
		cerr << "could not load the remove function in libumfpack.so \n";
		return 3;
	}

	OEMSolverCreator* theCreator=creator();
	*/
	SolverPluginProvider spp;
	OEMSolver* theSolver(NULL);
	try {
		OEMSolverCreator* theCreator=spp.create("./libamdis-umfpack.so");
		theCreator->setName("umfpack");
		theSolver=theCreator->create();
//		remover(theCreator);
		spp.remove(theCreator);
	}catch(SolverPluginProvider::Exception e) {
		std::cerr<< "could not load the umfpack solver: "<<e.message<<"\n";
		return 1;
	}
	mtl::matrix::compressed2D< double > testMatrix(10,10);
	mtl::matrix::diagonal_setup(testMatrix, 5.0);
	mtl::vector::dense_vector< double > b(10);
	b=4.0;
	mtl::vector::dense_vector< double > x(10);
	x=0.0;
	theSolver->solveSystem(testMatrix,x,b);
	delete theSolver;
	return 0;
}