Commit 35b11427 authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

* Some more optimization and bug fixes

parent 86d20202
...@@ -267,21 +267,6 @@ namespace AMDiS { ...@@ -267,21 +267,6 @@ namespace AMDiS {
} }
} }
DegreeOfFreedom DOFMatrix::logToPhysIndex(DegreeOfFreedom a,
DegreeOfFreedom b) const
{
int j;
for (j = 0; j < static_cast<int>(matrix[a].size()); j++)
if (b == matrix[a][j].col)
break;
return (j == static_cast<int>(matrix[a].size())) ? -1 : j;
}
double DOFMatrix::logAcc(DegreeOfFreedom a,DegreeOfFreedom b) const double DOFMatrix::logAcc(DegreeOfFreedom a,DegreeOfFreedom b) const
{ {
int j; int j;
......
...@@ -489,17 +489,25 @@ namespace AMDiS { ...@@ -489,17 +489,25 @@ namespace AMDiS {
/** \brief /** \brief
* Returns physical column index of logical index b in row a * Returns physical column index of logical index b in row a
*/ */
DegreeOfFreedom logToPhysIndex(DegreeOfFreedom a,DegreeOfFreedom b) const; inline DegreeOfFreedom logToPhysIndex(DegreeOfFreedom a, DegreeOfFreedom b) const
{
int size = static_cast<int>(matrix[a].size());
for (int j = 0; j < size; j++)
if (b == matrix[a][j].col)
return j;
return -1;
};
/** \brief /** \brief
* Returns value at logical indices a,b * Returns value at logical indices a,b
*/ */
double logAcc(DegreeOfFreedom a,DegreeOfFreedom b) const; double logAcc(DegreeOfFreedom a, DegreeOfFreedom b) const;
/** \brief /** \brief
* Changes col at logical indices a,b to c * Changes col at logical indices a,b to c
*/ */
void changeColOfEntry(DegreeOfFreedom a,DegreeOfFreedom b,DegreeOfFreedom c); void changeColOfEntry(DegreeOfFreedom a, DegreeOfFreedom b, DegreeOfFreedom c);
/** \brief /** \brief
* Changes col of \ref matrix[a][b] to c * Changes col of \ref matrix[a][b] to c
......
...@@ -266,12 +266,8 @@ namespace AMDiS { ...@@ -266,12 +266,8 @@ namespace AMDiS {
* Frees needed memory. * Frees needed memory.
*/ */
virtual void exit() { virtual void exit() {
int i;
int size = scalPrecons.getSize(); int size = scalPrecons.getSize();
#ifdef _OPENMP for (int i = 0; i < size; i++) {
#pragma omp parallel for num_threads(size)
#endif
for (i = 0; i < size; i++) {
scalPrecons[i]->exit(); scalPrecons[i]->exit();
} }
}; };
......
...@@ -704,6 +704,8 @@ namespace AMDiS { ...@@ -704,6 +704,8 @@ namespace AMDiS {
const BasisFunction *basisFcts = componentSpaces_[i]->getBasisFcts(); const BasisFunction *basisFcts = componentSpaces_[i]->getBasisFcts();
for (int j = 0; j < numComponents_; j++) { for (int j = 0; j < numComponents_; j++) {
double wwtime = omp_get_wtime();
// Only if this variable is true, the current matrix will be assembled. // Only if this variable is true, the current matrix will be assembled.
bool assembleMatrix = true; bool assembleMatrix = true;
// The DOFMatrix which should be assembled (or not, if assembleMatrix // The DOFMatrix which should be assembled (or not, if assembleMatrix
...@@ -774,6 +776,8 @@ namespace AMDiS { ...@@ -774,6 +776,8 @@ namespace AMDiS {
} }
assembledMatrix_[i][j] = true; assembledMatrix_[i][j] = true;
::std::cout << "Komponente " << i << "-" << j << ": " << omp_get_wtime() - wwtime << ::std::endl;
} }
// fill boundary conditions // fill boundary conditions
......
...@@ -72,7 +72,7 @@ namespace AMDiS { ...@@ -72,7 +72,7 @@ namespace AMDiS {
{ {
::std::cout << "["; ::std::cout << "[";
for (int i = 0; i < vec->size(); i++) { for (int i = 0; i < static_cast<int>(vec->size()); i++) {
::std::cout << (*vec)[i] << " , "; ::std::cout << (*vec)[i] << " , ";
} }
......
...@@ -647,7 +647,7 @@ namespace AMDiS { ...@@ -647,7 +647,7 @@ namespace AMDiS {
{ {
FUNCNAME("TraverseStackLLtraverseNeighbour3d()"); FUNCNAME("TraverseStackLLtraverseNeighbour3d()");
Element *el, *el2; Element *el2;
ElInfo *old_elinfo, *elinfo, *elinfo2; ElInfo *old_elinfo, *elinfo, *elinfo2;
const DegreeOfFreedom *dof; const DegreeOfFreedom *dof;
int i, nb, opp_vertex, stack2_used, typ = 0; int i, nb, opp_vertex, stack2_used, typ = 0;
...@@ -661,24 +661,25 @@ namespace AMDiS { ...@@ -661,24 +661,25 @@ namespace AMDiS {
Parametric *parametric = traverse_mesh->getParametric(); Parametric *parametric = traverse_mesh->getParametric();
if(parametric) elinfo_old = parametric->removeParametricInfo(elinfo_old); if (parametric)
elinfo_old = parametric->removeParametricInfo(elinfo_old);
TEST_EXIT_DBG(elinfo_old == elinfo_stack[stack_used]) TEST_EXIT_DBG(elinfo_old == elinfo_stack[stack_used])
("invalid old elinfo\n"); ("invalid old elinfo\n");
TEST_EXIT_DBG(elinfo_stack[stack_used]->getFillFlag().isSet(Mesh::FILL_NEIGH)) TEST_EXIT_DBG(elinfo_stack[stack_used]->getFillFlag().isSet(Mesh::FILL_NEIGH))
("FILL_NEIGH not set"); ("FILL_NEIGH not set");
el = elinfo_stack[stack_used]->getElement(); Element *el = elinfo_stack[stack_used]->getElement();
sav_index = el->getIndex(); sav_index = el->getIndex();
/* first, goto to leaf level, if necessary... */ /* first, goto to leaf level, if necessary... */
if ((traverse_fill_flag & Mesh::CALL_LEAF_EL).isAnySet()) { if ((traverse_fill_flag & Mesh::CALL_LEAF_EL).isAnySet()) {
if ((el->getChild(0)) && (neighbour < 2)) { if ((el->getChild(0)) && (neighbour < 2)) {
if (stack_used >= stack_size-1) if (stack_used >= stack_size - 1)
enlargeTraverseStack(); enlargeTraverseStack();
i = 1 - neighbour; i = 1 - neighbour;
elinfo_stack[stack_used+1]->fillElInfo(i, elinfo_stack[stack_used]); elinfo_stack[stack_used + 1]->fillElInfo(i, elinfo_stack[stack_used]);
info_stack[stack_used] = i+1; info_stack[stack_used] = i + 1;
stack_used++; stack_used++;
info_stack[stack_used] = 0; info_stack[stack_used] = 0;
neighbour = 3; neighbour = 3;
...@@ -692,18 +693,18 @@ namespace AMDiS { ...@@ -692,18 +693,18 @@ namespace AMDiS {
nb = neighbour; nb = neighbour;
while (stack_used > 1) /* go up in tree until we can go down again */ while (stack_used > 1) { /* go up in tree until we can go down again */
{
stack_used--; stack_used--;
typ = dynamic_cast<ElInfo3d*>( elinfo_stack[stack_used])->getType(); typ = dynamic_cast<ElInfo3d*>( elinfo_stack[stack_used])->getType();
nb = coarse_nb[typ][info_stack[stack_used]][nb]; nb = coarse_nb[typ][info_stack[stack_used]][nb];
if (nb == -1) break; if (nb == -1)
break;
TEST_EXIT_DBG(nb >= 0)("invalid coarse_nb %d\n",nb); TEST_EXIT_DBG(nb >= 0)("invalid coarse_nb %d\n",nb);
} }
/* save hierarchy information about current element */ /* save hierarchy information about current element */
for (i=stack_used; i<=save_stack_used; i++) { for (i = stack_used; i <= save_stack_used; i++) {
save_info_stack[i] = info_stack[i]; save_info_stack[i] = info_stack[i];
*(save_elinfo_stack[i]) = *(elinfo_stack[i]); *(save_elinfo_stack[i]) = *(elinfo_stack[i]);
} }
...@@ -811,20 +812,12 @@ namespace AMDiS { ...@@ -811,20 +812,12 @@ namespace AMDiS {
dof = el2->getDOF(1); dof = el2->getDOF(1);
if (dof != el->getDOF(1) && dof != el->getDOF(2) && if (dof != el->getDOF(1) && dof != el->getDOF(2) &&
!traverse_mesh->associated(dof[0], el->getDOF(1, 0)) && !traverse_mesh->associated(dof[0], el->getDOF(1, 0)) &&
!traverse_mesh->associated(dof[0], el->getDOF(2, 0))) !traverse_mesh->associated(dof[0], el->getDOF(2, 0))) {
{
stack2_used++; /* go down one level in OLD hierarchy */ stack2_used++; /* go down one level in OLD hierarchy */
elinfo2 = save_elinfo_stack[stack2_used]; elinfo2 = save_elinfo_stack[stack2_used];
el2 = elinfo2->getElement(); el2 = elinfo2->getElement();
} }
// else {
// // --- debug ---
// if(dof != el->getDOF(1) && dof != el->getDOF(2)) {
// MSG("dof %d, dof1 %d, dof2 %d\n\n",
// dof[0], el->getDOF(1,0), el->getDOF(2,0));
// }
// // -------------
// }
} }
} }
...@@ -854,8 +847,9 @@ namespace AMDiS { ...@@ -854,8 +847,9 @@ namespace AMDiS {
else if ((traverse_fill_flag & Mesh::CALL_EVERY_EL_INORDER).isAnySet()) else if ((traverse_fill_flag & Mesh::CALL_EVERY_EL_INORDER).isAnySet())
info_stack[stack_used] = 1; /* ??? */ info_stack[stack_used] = 1; /* ??? */
if(elinfo) { if (elinfo) {
if(parametric) elinfo = parametric->addParametricInfo(elinfo); if (parametric)
elinfo = parametric->addParametricInfo(elinfo);
elinfo->fillDetGrdLambda(); elinfo->fillDetGrdLambda();
} }
return(elinfo); return(elinfo);
......
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