Commit f06082db authored by Thomas Witkowski's avatar Thomas Witkowski

Work on BDDCML integration, still not working.

parent 10141fab
......@@ -66,27 +66,35 @@ namespace AMDiS {
int nLevel = 1;
int nSubdomains = meshDistributor->getMpiSize();
int length = 1;
int nLevel = 2;
int nSubdomains[nLevel];
nSubdomains[0] = meshDistributor->getMpiSize();
nSubdomains[1] = 1;
int nSubPerProc = 1;
MPI_Fint c2f = MPI_Comm_c2f(meshDistributor->getMpiComm());
int verboseLevel = 2;
int numbase = 0;
bddcml_init(&nLevel, &nSubdomains, &length, &nSubPerProc,
bddcml_init(&nLevel, nSubdomains, &nLevel, &nSubPerProc,
&c2f, &verboseLevel, &numbase);
// global number of elements
int nelem = mesh->getNumberOfLeaves();
mpi::globalAdd(nelem);
MSG("nelem = %d\n", nelem);
// global number of nodes
int nnod = meshDistributor->getNumberOverallDofs(feSpace);
MSG("nnod = %d\n", nnod);
// global number of dofs
int ndof = nnod * nComponents;
MSG("ndof = %d\n", ndof);
// space dimenstion
int ndim = 2;
......@@ -99,12 +107,16 @@ namespace AMDiS {
// local number of elements
int nelems = nLeafEls;
MSG("nelems = %d\n", nelems);
// local number of nodes
int nnods = feSpace->getAdmin()->getUsedSize();
// local number of dofs
int ndofs = nnods * nComponents;
MSG("local nnods %d ndofs %d\n", nnods, ndofs);
// Length of array inet
int linet = nelems * 3;
......@@ -112,6 +124,9 @@ namespace AMDiS {
int inet[linet];
elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_LEAF_EL);
while (elInfo) {
TEST_EXIT_DBG(mapElIndex.count(elInfo->getElement()->getIndex()))
("Should not happen!\n");
int localElIndex = mapElIndex[elInfo->getElement()->getIndex()];
for (int i = 0; i < 3; i++)
inet[localElIndex * 3 + i] = elInfo->getElement()->getDof(i, 0);
......@@ -135,7 +150,7 @@ namespace AMDiS {
isngn[i] = meshDistributor->mapLocalToGlobal(feSpace, i);
// array of indices of subdomain variables in global numbering
int isvgvn[ndof];
int isvgvn[ndofs];
for (int j = 0; j < nnods; j++)
for (int i = 0; i < nComponents; i++)
isvgvn[j * nComponents + i] =
......@@ -146,6 +161,7 @@ namespace AMDiS {
int rStartEl, nOverallEl;
mpi::getDofNumbering(meshDistributor->getMpiComm(),
nelems, rStartEl, nOverallEl);
MSG("rStartEl = %d\n", rStartEl);
for (int i = 0; i < nelems; i++)
isegn[i] = rStartEl + i;
......@@ -168,10 +184,12 @@ namespace AMDiS {
// local array of indices denoting dirichlet boundary data
int ifix[ndofs];
for (int i = 0; i < ndofs; i++)
ifix[ndofs] = -1;
ifix[i] = 0;
// local array of values for dirichlet boundary data
double fixv[ndofs];
for (int i = 0; i < ndofs; i++)
fixv[i] = 0.0;
// local rhs data
double rhs[ndofs];
......@@ -182,7 +200,7 @@ namespace AMDiS {
}
// Completenes of the rhs vector on subdomains
int is_rhs_complete = 1;
int is_rhs_complete = 0;
// Local array with initial solution guess
double sol[ndofs];
......@@ -206,9 +224,11 @@ namespace AMDiS {
// Number of non-zero entries in matrix
int la = i_sparse.size();
MSG("LOCAL LA = %d\n", la);
// Matrix is assembled
int is_assembled_int = 1;
int is_assembled_int = 0;
bddcml_upload_subdomain_data(&nelem,
......@@ -229,7 +249,7 @@ namespace AMDiS {
isngn,
&nnods,
isvgvn,
&ndof,
&ndofs,
isegn,
&nelems,
xyz,
......@@ -255,13 +275,14 @@ namespace AMDiS {
int use_defaults_int = 1;
int parallel_division_int = 1;
int use_arithmetic_int = 1;
int use_adaptive_int = 1;
int use_adaptive_int = 0;
MSG("BDDC POINT A\n");
bddcml_setup_preconditioner(&matrixtype,
&use_defaults_int,
&parallel_division_int,
&use_arithmetic_int,
&use_adaptive_int);
MSG("BDDC POINT B\n");
int method = 1;
double tol = 1.e-6;
......@@ -280,6 +301,8 @@ namespace AMDiS {
&converged_reason,
&condition_number);
MSG("BDDC POINT C\n");
MSG("BDDCML converged reason: %d within %d iterations \n",
converged_reason, num_iter);
......@@ -294,9 +317,9 @@ namespace AMDiS {
void BddcMlSolver::addDofMatrix(DOFMatrix* dmat,
vector<int> i_sparse,
vector<int> j_sparse,
vector<double> a_sparse,
vector<int>& i_sparse,
vector<int>& j_sparse,
vector<double>& a_sparse,
int nComponents,
int ithRowComponent,
int ithColComponent)
......
......@@ -51,9 +51,9 @@ namespace AMDiS {
protected:
void addDofMatrix(DOFMatrix* mat,
vector<int> i_sparse,
vector<int> j_sparse,
vector<double> a_sparse,
vector<int>& i_sparse,
vector<int>& j_sparse,
vector<double>& a_sparse,
int nComponents,
int ithRowComponent,
int ithColComponent);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment