ComponentTraverseInfo.cc 3.01 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
//
// Software License for AMDiS
//
// Copyright (c) 2010 Dresden University of Technology 
// All rights reserved.
// Authors: Simon Vey, Thomas Witkowski et al.
//
// This file is part of AMDiS
//
// See also license.opensource.txt in the distribution.


Thomas Witkowski's avatar
Thomas Witkowski committed
13
14
15
16
17
18
19
20
21
22
23
24
25
#include "ComponentTraverseInfo.h"

namespace AMDiS {
  const int SingleComponentInfo::EMPTY = 0;
  const int SingleComponentInfo::EQ_SPACES_NO_AUX = 1;
  const int SingleComponentInfo::EQ_SPACES_WITH_AUX = 2;
  const int SingleComponentInfo::EQ_SPACES_WITH_DIF_AUX = 3;
  const int SingleComponentInfo::DIF_SPACES_NO_AUX = 4;
  const int SingleComponentInfo::DIF_SPACES_WITH_AUX = 5;
  const int SingleComponentInfo::DIF_SPACES_WITH_DIF_AUX = 6;

  void SingleComponentInfo::updateStatus()
  {
26
    if (rowFeSpace == NULL) {
Thomas Witkowski's avatar
Thomas Witkowski committed
27
28
29
30
      status = SingleComponentInfo::EMPTY;
      return;
    }

31
32
33
    if (colFeSpace == NULL || 
	(colFeSpace != NULL && rowFeSpace->getMesh() == colFeSpace->getMesh())) {
      if (auxFeSpaces.size() == 0) {
Thomas Witkowski's avatar
Thomas Witkowski committed
34
35
36
	status = SingleComponentInfo::EQ_SPACES_NO_AUX;
      } else {
	status = SingleComponentInfo::EQ_SPACES_WITH_AUX;
37
38
39
40

	for (std::set<const FiniteElemSpace*>::iterator it = auxFeSpaces.begin();
	     it != auxFeSpaces.end(); ++it) {
	  if ((*it)->getMesh() != rowFeSpace->getMesh()) {     
Thomas Witkowski's avatar
Thomas Witkowski committed
41
42
43
44
45
46
	    status = SingleComponentInfo::EQ_SPACES_WITH_DIF_AUX;
	    break;
	  }
	}
      }
    } else {
47
      if (auxFeSpaces.size() == 0) {
Thomas Witkowski's avatar
Thomas Witkowski committed
48
49
50
	status = SingleComponentInfo::DIF_SPACES_NO_AUX;
      } else {
	status = SingleComponentInfo::DIF_SPACES_WITH_AUX;
51
52
53
54
	for (std::set<const FiniteElemSpace*>::iterator it = auxFeSpaces.begin();
	     it != auxFeSpaces.end(); ++it) {
	  if ((*it)->getMesh() != rowFeSpace->getMesh() &&
	      (*it)->getMesh() != colFeSpace->getMesh()) {
Thomas Witkowski's avatar
Thomas Witkowski committed
55
56
57
58
59
60
61
62
	    status = SingleComponentInfo::DIF_SPACES_WITH_DIF_AUX;
	    break;
	  }
	}
      }	
    }    
  }

63
64
65
  
  const FiniteElemSpace* ComponentTraverseInfo::getRowFeSpace(int row)
  {
66
    FUNCNAME_DBG("ComponentTraverseInfo::getRowFeSpace()");
67
68
69
70
71
72
73
74
75
76
77
78
    
    TEST_EXIT_DBG(row < nComponents)("No component traverse info for this row!\n");
    TEST_EXIT_DBG(matrixComponents[row][row].getRowFeSpace() ==
		  matrixComponents[row][row].getColFeSpace())
      ("Should not happen!\n");
    
    return matrixComponents[row][row].getRowFeSpace();      
  }


  const FiniteElemSpace* ComponentTraverseInfo::getNonRowFeSpace(int row)
  {
79
    FUNCNAME_DBG("ComponentTraverseInfo::getNonRowFeSpace()");
80
81
82
83
84
85
86
87
88
89

    TEST_EXIT_DBG(row < nComponents)("No component traverse info for this row!\n");
    
    const FiniteElemSpace* rowFeSpace = getRowFeSpace(row);
    
    TEST_EXIT_DBG(rowFeSpace != NULL)("No row FE space!\n");
    
    for (int i = 0; i < nComponents; i++) {
      if (matrixComponents[row][i].getColFeSpace() != rowFeSpace)
	return matrixComponents[row][i].getColFeSpace();
90
91
      if (matrixComponents[row][i].getAuxFeSpace() != rowFeSpace)
	return matrixComponents[row][i].getAuxFeSpace();
92
93
    }
    
94
95
    if (vectorComponents[row].getAuxFeSpace() != rowFeSpace)
      return vectorComponents[row].getAuxFeSpace();
96
97
98
99
    
    return NULL;
  }

Thomas Witkowski's avatar
Thomas Witkowski committed
100
}