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