1#ifndef ExporterParaViewAMR_def_hpp
2#define ExporterParaViewAMR_def_hpp
4#include "ExporterParaViewAMR_decl.hpp"
16template<
class SC,
class LO,
class GO,
class NO>
17ExporterParaViewAMR<SC,LO,GO,NO>::ExporterParaViewAMR():
23template<
class SC,
class LO,
class GO,
class NO>
24void ExporterParaViewAMR<SC,LO,GO,NO>::reSetup(MeshPtr_Type mesh){
27 this->nmbElementsGlob_ = this->mesh_->getNumElementsGlobal();
28 this->pointsUnique_ = this->mesh_->getPointsUnique();
29 this->nmbPointsGlob_ = this->mesh_->getMapUnique()->getGlobalNumElements();
31 MapConstPtr_Type elementMap = this->mesh_->getElementMap();
32 Teuchos::ArrayView<const GO> nodeElementList = elementMap->getNodeElementList();
33 vec_int_Type nodeElementListInteger( this->nmbPointsPerElement_ * nodeElementList.size() );
36 for (
int i=0; i<nodeElementList.size(); i++) {
37 for (
int j=0; j< this->nmbPointsPerElement_; j++){
38 nodeElementListInteger[counter] = (int) this->nmbPointsPerElement_*nodeElementList[i] + j;
42 Teuchos::RCP<Epetra_BlockMap> mapElements;
44 if (nodeElementListInteger.size()>0)
45 mapElements.reset(
new Epetra_BlockMap( (
int) (this->nmbPointsPerElement_*this->nmbElementsGlob_), (
int) nodeElementListInteger.size(), &nodeElementListInteger[0],1, 0, *this->commEpetra_));
47 mapElements.reset(
new Epetra_BlockMap( (
int) (this->nmbPointsPerElement_*this->nmbElementsGlob_), (
int) nodeElementListInteger.size(), NULL,1, 0, *this->commEpetra_));
49 this->elementsHDF_.reset(
new Epetra_IntVector(*mapElements));
51 ElementsPtr_Type elements = this->mesh_->getElementsC();
54 for (
int i=0; i<elements->numberElements(); i++) {
55 for (
int j=0; j<this->nmbPointsPerElement_; j++) {
56 int globalIndex = (int) mesh->getMapRepeated()->getGlobalElement( elements->getElement(i).getNode(j) );
57 (*this->elementsHDF_)[counter] = globalIndex;
62 Teuchos::ArrayView< const GO > indices = this->mesh_->getMapUnique()->getNodeElementList();
63 int* intGlobIDs =
new int[indices.size()];
64 for (
int i=0; i<indices.size(); i++) {
65 intGlobIDs[i] = (int) indices[i];
68 EpetraMapPtr_Type mapEpetra = Teuchos::rcp(
new Epetra_Map((
int)this->nmbPointsGlob_,indices.size(),intGlobIDs,0,*this->commEpetra_));
71 this->pointsHDF_.reset(
new Epetra_MultiVector(*mapEpetra,this->dim_));
76 std::string nameConn =
"Connections" + std::to_string(this->timeIndex_);
77 this->writeMeshElements(nameConn);
82template<
class SC,
class LO,
class GO,
class NO>
83void ExporterParaViewAMR<SC,LO,GO,NO>::updateVariables(MultiVectorConstPtr_Type &u, std::string varName){
85 for (
int i=0; i<this->variables_.size(); i++) {
86 if(this->varNames_[i] == varName){
87 this->variables_[i] = u;
88 if (this->FEType_ ==
"P0") {
89 this->mapUniqueVariables_ = this->mesh_->getElementMap();
92 this->mapUniqueVariables_= this->mesh_->getMapUnique();
94 this->nmbExportValuesGlob_ = this->mapUniqueVariables_->getGlobalNumElements();
95 Teuchos::ArrayView< const GO > indices = this->mapUniqueVariables_->getNodeElementList();
96 int* intGlobIDs =
new int[indices.size()];
97 for (
int j=0; j<indices.size(); j++) {
98 intGlobIDs[j] = (int) indices[j];
101 EpetraMapPtr_Type mapToStore = Teuchos::rcp(
new Epetra_Map( (
int) this->mapUniqueVariables_->getGlobalNumElements(), indices.size(), intGlobIDs,0, *this->commEpetra_ ) );
103 this->uniqueMaps_[i] =mapToStore;
104 delete [] intGlobIDs;
Definition ExporterParaView_decl.hpp:44
Adaptive Mesh Refinement.
Definition AdaptiveMeshRefinement.cpp:5