Commit 643968b8 authored by Thomas Witkowski's avatar Thomas Witkowski

Add missing files.

parent c81995a9
#include "ElementObjectData.h"
namespace AMDiS {
void ElementObjects::createRankData()
{
for (std::map<DegreeOfFreedom, std::vector<ElementObjectData> >::iterator it = vertexElements.begin();
it != vertexElements.end(); ++it) {
for (std::vector<ElementObjectData>::iterator it2 = it->second.begin(); it2 != it->second.end(); ++it2) {
int elOwner = elementInRank[it2->elIndex];
if (it2->elIndex > vertexInRank[it->first][elOwner].elIndex)
vertexInRank[it->first][elOwner] = *it2;
}
}
for (std::map<DofEdge, std::vector<ElementObjectData> >::iterator it = edgeElements.begin();
it != edgeElements.end(); ++it) {
for (std::vector<ElementObjectData>::iterator it2 = it->second.begin(); it2 != it->second.end(); ++it2) {
int elOwner = elementInRank[it2->elIndex];
if (it2->elIndex > edgeInRank[it->first][elOwner].elIndex)
edgeInRank[it->first][elOwner] = *it2;
}
}
for (std::map<DofFace, std::vector<ElementObjectData> >::iterator it = faceElements.begin();
it != faceElements.end(); ++it) {
for (std::vector<ElementObjectData>::iterator it2 = it->second.begin(); it2 != it->second.end(); ++it2) {
int elOwner = elementInRank[it2->elIndex];
if (it2->elIndex > faceInRank[it->first][elOwner].elIndex)
faceInRank[it->first][elOwner] = *it2;
}
}
}
}
// ============================================================================
// == ==
// == AMDiS - Adaptive multidimensional simulations ==
// == ==
// ============================================================================
// == ==
// == TU Dresden ==
// == ==
// == Institut fr Wissenschaftliches Rechnen ==
// == Zellescher Weg 12-14 ==
// == 01069 Dresden ==
// == germany ==
// == ==
// ============================================================================
// == ==
// == https://gforge.zih.tu-dresden.de/projects/amdis/ ==
// == ==
// ============================================================================
/** \file ElementObjectData.h */
#ifndef AMDIS_ELEMENTOBJECTDATA_H
#define AMDIS_ELEMENTOBJECTDATA_H
#include <map>
#include <vector>
#include <boost/tuple/tuple.hpp>
#include <boost/tuple/tuple_comparison.hpp>
#include "Global.h"
#include "Boundary.h"
namespace AMDiS {
struct ElementObjectData {
ElementObjectData(int a = -1, int b = 0, BoundaryType c = INTERIOR)
: elIndex(a),
ithObject(b),
boundaryType(c)
{}
int elIndex;
int ithObject;
BoundaryType boundaryType;
};
class ElementObjects {
public:
ElementObjects(std::map<int, int> vec)
: elementInRank(vec),
iterGeoPos(CENTER)
{}
void addVertex(DegreeOfFreedom vertex,
int elIndex, int ith, BoundaryType bound = INTERIOR)
{
vertexElements[vertex].push_back(ElementObjectData(elIndex, ith, bound));
vertexOwner[vertex] = std::max(vertexOwner[vertex], elementInRank[elIndex]);
}
void addEdge(DofEdge edge,
int elIndex, int ith, BoundaryType bound = INTERIOR)
{
edgeElements[edge].push_back(ElementObjectData(elIndex, ith, bound));
edgeOwner[edge] = std::max(edgeOwner[edge], elementInRank[elIndex]);
}
void addFace(DofFace face,
int elIndex, int ith, BoundaryType bound = INTERIOR)
{
faceElements[face].push_back(ElementObjectData(elIndex, ith, bound));
faceOwner[face] = std::max(faceOwner[face], elementInRank[elIndex]);
}
void createRankData();
bool iterate(GeoIndex pos)
{
if (iterGeoPos == CENTER) {
iterGeoPos = pos;
switch (iterGeoPos) {
case VERTEX:
vertexIter = vertexInRank.begin();
break;
case EDGE:
edgeIter = edgeInRank.begin();
break;
case FACE:
faceIter = faceInRank.begin();
break;
default:
ERROR_EXIT("Not GeoIndex %d!\n", iterGeoPos);
}
} else {
switch (iterGeoPos) {
case VERTEX:
++vertexIter;
break;
case EDGE:
++edgeIter;
break;
case FACE:
++faceIter;
break;
default:
ERROR_EXIT("Not GeoIndex %d!\n", iterGeoPos);
}
}
switch (iterGeoPos) {
case VERTEX:
if (vertexIter == vertexInRank.end()) {
iterGeoPos = CENTER;
return false;
}
break;
case EDGE:
if (edgeIter == edgeInRank.end()) {
iterGeoPos = CENTER;
return false;
}
break;
case FACE:
if (faceIter == faceInRank.end()) {
iterGeoPos = CENTER;
return false;
}
break;
default:
ERROR_EXIT("Should not happen!\n");
}
return true;
}
std::map<int, ElementObjectData>& getIterateData()
{
switch (iterGeoPos) {
case VERTEX:
return vertexIter->second;
break;
case EDGE:
return edgeIter->second;
break;
case FACE:
return faceIter->second;
break;
default:
ERROR_EXIT("Should not happen!\n");
// Will never be reached, just to avoid compiler warnings.
return faceIter->second;
}
}
int getIterateOwner()
{
switch (iterGeoPos) {
case VERTEX:
return vertexOwner[vertexIter->first];
break;
case EDGE:
return edgeOwner[edgeIter->first];
break;
case FACE:
return faceOwner[faceIter->first];
break;
default:
ERROR_EXIT("Should not happen!\n");
// Will never be reached, just to avoid compiler warnings.
return -1;
}
}
int getOwner(DegreeOfFreedom vertex)
{
return vertexOwner[vertex];
}
int getOwner(DofEdge edge)
{
return edgeOwner[edge];
}
int getOwner(DofFace face)
{
return faceOwner[face];
}
std::vector<ElementObjectData>& getElements(DegreeOfFreedom vertex)
{
return vertexElements[vertex];
}
std::vector<ElementObjectData>& getElements(DofEdge edge)
{
return edgeElements[edge];
}
std::vector<ElementObjectData>& getElements(DofFace face)
{
return faceElements[face];
}
private:
std::map<int, int> elementInRank;
std::map<DegreeOfFreedom, std::vector<ElementObjectData> > vertexElements;
std::map<DofEdge, std::vector<ElementObjectData> > edgeElements;
std::map<DofFace, std::vector<ElementObjectData> > faceElements;
std::map<DegreeOfFreedom, int> vertexOwner;
std::map<DofEdge, int> edgeOwner;
std::map<DofFace, int> faceOwner;
std::map<DegreeOfFreedom, std::map<int, ElementObjectData> > vertexInRank;
std::map<DofEdge, std::map<int, ElementObjectData> > edgeInRank;
std::map<DofFace, std::map<int, ElementObjectData> > faceInRank;
std::map<DegreeOfFreedom, std::map<int, ElementObjectData> >::iterator vertexIter;
std::map<DofEdge, std::map<int, ElementObjectData> >::iterator edgeIter;
std::map<DofFace, std::map<int, ElementObjectData> >::iterator faceIter;
GeoIndex iterGeoPos;
};
}
#endif
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