ElementObjectData.cc 1.85 KB
Newer Older
Thomas Witkowski's avatar
Thomas Witkowski committed
1
2
3
4
#include "ElementObjectData.h"

namespace AMDiS {

Thomas Witkowski's avatar
Thomas Witkowski committed
5
  void ElementObjects::createRankData(std::map<int, int>& macroElementRankMap) 
Thomas Witkowski's avatar
Thomas Witkowski committed
6
  {
Thomas Witkowski's avatar
Thomas Witkowski committed
7
8
9
10
    FUNCNAME("ElementObjects::createRankData()");

    vertexOwner.clear();
    vertexInRank.clear();
Thomas Witkowski's avatar
Thomas Witkowski committed
11
12
    for (std::map<DegreeOfFreedom, std::vector<ElementObjectData> >::iterator it = vertexElements.begin();
	 it != vertexElements.end(); ++it) {
Thomas Witkowski's avatar
Thomas Witkowski committed
13
14
15
      for (std::vector<ElementObjectData>::iterator it2 = it->second.begin(); 
	   it2 != it->second.end(); ++it2) {
	int elementInRank = macroElementRankMap[it2->elIndex];
Thomas Witkowski's avatar
Thomas Witkowski committed
16
	
Thomas Witkowski's avatar
Thomas Witkowski committed
17
18
19
20
	if (it2->elIndex > vertexInRank[it->first][elementInRank].elIndex)
	  vertexInRank[it->first][elementInRank] = *it2;

	vertexOwner[it->first] = std::max(vertexOwner[it->first], elementInRank);
Thomas Witkowski's avatar
Thomas Witkowski committed
21
22
23
      }
    }
    
Thomas Witkowski's avatar
Thomas Witkowski committed
24
25
26

    edgeOwner.clear();
    edgeInRank.clear();
Thomas Witkowski's avatar
Thomas Witkowski committed
27
28
    for (std::map<DofEdge, std::vector<ElementObjectData> >::iterator it = edgeElements.begin();
	 it != edgeElements.end(); ++it) {
Thomas Witkowski's avatar
Thomas Witkowski committed
29
30
31
      for (std::vector<ElementObjectData>::iterator it2 = it->second.begin(); 
	   it2 != it->second.end(); ++it2) {
	int elementInRank = macroElementRankMap[it2->elIndex];
Thomas Witkowski's avatar
Thomas Witkowski committed
32
	
Thomas Witkowski's avatar
Thomas Witkowski committed
33
34
35
36
	if (it2->elIndex > edgeInRank[it->first][elementInRank].elIndex)
	  edgeInRank[it->first][elementInRank] = *it2;

	edgeOwner[it->first] = std::max(edgeOwner[it->first], elementInRank);
Thomas Witkowski's avatar
Thomas Witkowski committed
37
38
39
      }
    }
    
Thomas Witkowski's avatar
Thomas Witkowski committed
40
41
42

    faceOwner.clear();
    faceInRank.clear();
Thomas Witkowski's avatar
Thomas Witkowski committed
43
44
    for (std::map<DofFace, std::vector<ElementObjectData> >::iterator it = faceElements.begin();
	 it != faceElements.end(); ++it) {
Thomas Witkowski's avatar
Thomas Witkowski committed
45
46
47
      for (std::vector<ElementObjectData>::iterator it2 = it->second.begin(); 
	   it2 != it->second.end(); ++it2) {
	int elementInRank = macroElementRankMap[it2->elIndex];
Thomas Witkowski's avatar
Thomas Witkowski committed
48
	
Thomas Witkowski's avatar
Thomas Witkowski committed
49
50
51
52
	if (it2->elIndex > faceInRank[it->first][elementInRank].elIndex)
	  faceInRank[it->first][elementInRank] = *it2;

	faceOwner[it->first] = std::max(faceOwner[it->first], elementInRank);
Thomas Witkowski's avatar
Thomas Witkowski committed
53
54
55
56
57
      }
    }
  }

}