Finite Element Domain Decomposition Library
FEDDLib
Loading...
Searching...
No Matches
ExporterParaViewAMR_def.hpp
1#ifndef ExporterParaViewAMR_def_hpp
2#define ExporterParaViewAMR_def_hpp
3
11
12namespace FEDD {
13
14template<class SC,class LO,class GO,class NO>
15ExporterParaViewAMR<SC,LO,GO,NO>::ExporterParaViewAMR():
16ExporterParaView<SC,LO,GO,NO>()
17{
18
19}
20
21template<class SC,class LO,class GO,class NO>
22void ExporterParaViewAMR<SC,LO,GO,NO>::reSetup(MeshPtr_Type mesh){
23
24 this->mesh_ = mesh;
25 this->nmbElementsGlob_ = this->mesh_->getNumElementsGlobal();
26 this->pointsUnique_ = this->mesh_->getPointsUnique();
27 this->nmbPointsGlob_ = this->mesh_->getMapUnique()->getGlobalNumElements();
28
29 // Something different happens to the element List and the elements
30 // Probably have the following form:
31 // ElementMap : 0 1 2 3 4 5
32 // -> 0 1 2 3 4 5 6 7 8 ...
33 // Element GIDs: 0 1 2 3 ...
34 // Where the map tells us which IDs belong to which element
35 MapConstPtr_Type elementMap = this->mesh_->getElementMap();
36 Teuchos::ArrayView<const GO> nodeElementList = elementMap->getNodeElementList(); // Global Ids on this processor
37 vec_GO_Type nodeElementListInteger( this->nmbPointsPerElement_ * nodeElementList.size() );
38 int counter=0;
39 for (int i=0; i<nodeElementList.size(); i++) { // Number of elements
40 for (int j=0; j<this->nmbPointsPerElement_; j++){ // number of points per element
41 nodeElementListInteger[counter] = (int) this->nmbPointsPerElement_*nodeElementList[i] + j;
42 counter++; // from 0 ... to nmbPointsPerElement_*localElements
43 }
44 }
45 Teuchos::ArrayView<GO> globalMapIDs = Teuchos::arrayViewFromVector( nodeElementListInteger);
46 MapPtr_Type mapElements = Teuchos::rcp( new Map_Type((int) (this->nmbPointsPerElement_*this->nmbElementsGlob_), globalMapIDs,elementMap->getIndexBase()*this->nmbPointsPerElement_, this->comm_));
47
48 // They contain global IDs of nodes corresponding to 'elements'
49 this->elementsHDF_.reset(new MultiVector_Type(mapElements,1));
50
51 ElementsPtr_Type elements = this->mesh_->getElementsC();
52 counter = 0;
53 for (int i=0; i<elements->numberElements(); i++) {
54 for (int j=0; j<this->nmbPointsPerElement_; j++) {
55 int globalIndex = (int) this->mesh_->getMapRepeated()->getGlobalElement( elements->getElement(i).getNode(j) );
56 (this->elementsHDF_->getDataNonConst(0))[counter] = globalIndex;
57 counter++;
58 }
59 }
60
61 this->pointsHDF_.reset(new MultiVector_Type(this->mesh_->getMapUnique(),this->dim_));
62
63 this->updatePoints();
64
65 this->redo_=true;
66 std::string nameConn = "Connections" + std::to_string(this->timeIndex_);
67 this->writeMeshElements(nameConn);
68
69}
70
71template<class SC,class LO,class GO,class NO>
72void ExporterParaViewAMR<SC,LO,GO,NO>::updateVariables(MultiVectorConstPtr_Type &u, std::string varName){
73
74 for (int i=0; i<this->variables_.size(); i++) {
75 if(this->varNames_[i] == varName){
76 this->variables_[i] = u;
77 if (this->FEType_ == "P0") {
78 this->mapUniqueVariables_ = this->mesh_->getElementMap();
79 }
80 else
81 this->mapUniqueVariables_= this->mesh_->getMapUnique();
82
83 this->nmbExportValuesGlob_ = this->mapUniqueVariables_->getGlobalNumElements();
84
85 this->uniqueMaps_[i] =this->mapUniqueVariables_;
86 }
87 }
88
89}
90
91
92
93
94}
95#endif
Definition ExporterParaView_decl.hpp:30
Adaptive Mesh Refinement.
Definition AdaptiveMeshRefinement_decl.hpp:36