3#include "Domain_decl.hpp"
15template <
class SC,
class LO,
class GO,
class NO>
20mapVecFieldRepeated_(),
23distancesToInterface_(),
25interfaceMapVecFieldUnique_(),
26globalInterfaceMapUnique_(),
27globalInterfaceMapVecFieldUnique_(),
28partialGlobalInterfaceVecFieldMap_(),
29otherGlobalInterfaceMapUnique_(),
30otherGlobalInterfaceMapVecFieldUnique_(),
31otherPartialGlobalInterfaceVecFieldMap_()
36template <
class SC,
class LO,
class GO,
class NO>
41mapVecFieldRepeated_(),
44distancesToInterface_(),
46interfaceMapVecFieldUnique_(),
47globalInterfaceMapUnique_(),
48globalInterfaceMapVecFieldUnique_(),
49partialGlobalInterfaceVecFieldMap_(),
50otherGlobalInterfaceMapUnique_(),
51otherGlobalInterfaceMapVecFieldUnique_(),
52otherPartialGlobalInterfaceVecFieldMap_()
57template <
class SC,
class LO,
class GO,
class NO>
63mapVecFieldRepeated_(),
66distancesToInterface_(),
68interfaceMapVecFieldUnique_(),
69globalInterfaceMapUnique_(),
70globalInterfaceMapVecFieldUnique_(),
71partialGlobalInterfaceVecFieldMap_(),
72otherGlobalInterfaceMapUnique_(),
73otherGlobalInterfaceMapVecFieldUnique_(),
74otherPartialGlobalInterfaceVecFieldMap_()
80template <
class SC,
class LO,
class GO,
class NO>
85mapVecFieldRepeated_(),
88distancesToInterface_(),
90interfaceMapVecFieldUnique_(),
91globalInterfaceMapUnique_(),
92globalInterfaceMapVecFieldUnique_(),
93partialGlobalInterfaceVecFieldMap_(),
94 otherGlobalInterfaceMapUnique_(),
95 otherGlobalInterfaceMapVecFieldUnique_(),
96 otherPartialGlobalInterfaceVecFieldMap_()
103 geometries2DVec_.reset(
new string_vec_Type(0));
104 geometries2DVec_->push_back(
"Square");
105 geometries2DVec_->push_back(
"BFS");
107 geometries2DVec_->push_back(
"structuredMiniTest");
112template <
class SC,
class LO,
class GO,
class NO>
117mapVecFieldRepeated_(),
120distancesToInterface_(),
121interfaceMapUnique_(),
122interfaceMapVecFieldUnique_(),
123globalInterfaceMapUnique_(),
124globalInterfaceMapVecFieldUnique_(),
125partialGlobalInterfaceVecFieldMap_()
132 geometries3DVec_.reset(
new string_vec_Type(0));
133 geometries3DVec_->push_back(
"Square");
134 geometries3DVec_->push_back(
"BFS");
135 geometries3DVec_->push_back(
"Square5Element");
140template <
class SC,
class LO,
class GO,
class NO>
145 LO numberNodes = this->
getMapUnique()->getNodeNumElements();
146 Teuchos::reduceAll( *this->comm_, Teuchos::REDUCE_MIN, numberNodes, Teuchos::ptrFromRef(minNumberNodes) );
147 Teuchos::reduceAll( *this->comm_, Teuchos::REDUCE_MAX, numberNodes, Teuchos::ptrFromRef(maxNumberNodes) );
149 bool verbose(comm_->getRank()==0);
151 std::cout <<
"\t### Domain ###" << std::endl;
152 std::cout <<
"\t### Dimension: "<< dim_ << std::endl;
153 std::cout <<
"\t### Mesh type: "<< meshType_ << std::endl;
154 std::cout <<
"\t### Mesh flags: "<< flagsOption_ << std::endl;
155 std::cout <<
"\t### Subdomains: "<< n_ << std::endl;
156 std::cout <<
"\t### H/h: "<< m_ << std::endl;
157 std::cout <<
"\t### FE type: "<< FEType_ << std::endl;
158 std::cout <<
"\t### Number Nodes: "<< mesh_->getMapUnique()->getMaxAllGlobalIndex()+1 << std::endl;
159 std::cout <<
"\t### Minimum number of nodes: "<< minNumberNodes <<
" Maximum number of nodes: " << maxNumberNodes << std::endl;
160 std::cout <<
"\t### Empty ranks for coarse solves: "<< numProcsCoarseSolve_ << std::endl;
164template <
class SC,
class LO,
class GO,
class NO>
170template <
class SC,
class LO,
class GO,
class NO>
172 return mesh_->getElementsFlag();
176template <
class SC,
class LO,
class GO,
class NO>
178 if (this->dim_ == 2) {
179 if ( this->FEType_ ==
"P1" ) {
182 else if ( this->FEType_ ==
"P2" ) {
189 if ( this->FEType_ ==
"P1" ) {
192 else if ( this->FEType_ ==
"P2" ) {
203template <
class SC,
class LO,
class GO,
class NO>
208#ifdef ASSERTS_WARNINGS
209 MYASSERT(geoNumber!=-1,
"Geometry not known for this Dimension.")
212 MeshStrPtr_Type meshStructured = Teuchos::rcp(
new MeshStr_Type(comm_));
217 numProcsCoarseSolve_ = numProcsCoarseSolve;
218 meshType_ = meshType;
219 flagsOption_ = flagsOption;
225 meshStructured->setGeometry2DRectangle(coorRec, length, height);
226 meshStructured->buildMesh2D(FEType, n_, m_, numProcsCoarseSolve);
229 meshStructured->setGeometry2DRectangle(coorRec, length, height);
230 meshStructured->buildMesh2DBFS(FEType, n_, m_, numProcsCoarseSolve);
233 TEUCHOS_TEST_FOR_EXCEPTION(
true,std::logic_error,
"Select valid mesh. Structured types are 'structured' and 'structured_bfs' in 2D.");
241 meshStructured->setGeometry3DBox(coorRec, length, width, height);
242 meshStructured->buildMesh3D( FEType, n_, m_, numProcsCoarseSolve);
245 meshStructured->setGeometry3DBox(coorRec, length, width, height);
246 meshStructured->buildMesh3DBFS( FEType, n_, m_, numProcsCoarseSolve);
249 meshStructured->setGeometry3DBox(coorRec, length, width, height);
250 meshStructured->buildMesh3D5Elements( FEType, n_, m_, numProcsCoarseSolve);
253 TEUCHOS_TEST_FOR_EXCEPTION(
true,std::runtime_error,
"Select valid mesh. Structured types are 'structured' and 'structured_bfs' in 3D." );
258 TEUCHOS_TEST_FOR_EXCEPTION(
true,std::logic_error,
"Select valid mesh dimension. 2 or 3 dimensional meshes can be constructed.");
261 meshStructured->buildElementMap();
262 meshStructured->setStructuredMeshFlags(flagsOption,FEType);
263 meshStructured->buildSurfaces(flagsOption,FEType);
265 mesh_ = meshStructured;
268template <
class SC,
class LO,
class GO,
class NO>
271 MeshUnstrPtr_Type meshUnstructured = Teuchos::rcp(
new MeshUnstr_Type(comm_, volumeID));
272 mesh_ = meshUnstructured;
273 mesh_->dim_ = dimension;
275 meshType_ =
"unstructured";
276 numProcsCoarseSolve_ = 0;
277 n_ = comm_->getSize() - numProcsCoarseSolve_;
282template <
class SC,
class LO,
class GO,
class NO>
285 MeshUnstrPtr_Type meshUnstructured = Teuchos::rcp_dynamic_cast<MeshUnstr_Type>( mesh_ );
286 TEUCHOS_TEST_FOR_EXCEPTION( meshUnstructured.is_null(), std::runtime_error,
"Unstructured Mesh is null." );
288 meshUnstructured->setMeshFileName( filename, delimiter );
289 meshUnstructured->readMeshSize( );
293template <
class SC,
class LO,
class GO,
class NO>
296 MeshUnstrPtr_Type meshUnstructured = Teuchos::rcp_dynamic_cast<MeshUnstr_Type>( mesh_ );
298 if (partitionDistance)
301 mesh_ = meshUnstructured;
305template <
class SC,
class LO,
class GO,
class NO>
308 vec_dbl_Type tmp = *distancesToInterface_;
310 distancesToInterface_.reset(
new vec_dbl_Type ( mesh_->getMapRepeated()->getNodeNumElements() ) );
312 for (UN i=0; i<distancesToInterface_->size(); i++) {
313 GO index = mesh_->getMapRepeated()->getGlobalElement(i);
314 distancesToInterface_->at(i) = tmp[index];
318template <
class SC,
class LO,
class GO,
class NO>
321 MeshUnstrPtr_Type meshUnstructured = Teuchos::rcp(
new MeshUnstr_Type(comm_, volumeID));
326 mesh_ = meshUnstructured;
328 numProcsCoarseSolve_ = 0;
329 n_ = comm_->getSize() - numProcsCoarseSolve_;
332 meshType_ =
"unstructured";
335template <
class SC,
class LO,
class GO,
class NO>
338 MeshUnstrPtr_Type meshUnstructuredP1 = Teuchos::rcp_dynamic_cast<MeshUnstr_Type>( domainP1->mesh_ );
340 MeshUnstrPtr_Type meshUnstructured = Teuchos::rcp(
new MeshUnstr_Type( comm_, meshUnstructuredP1->volumeID_) );
344 dim_ = domainP1->dim_;
346 numProcsCoarseSolve_ = 0;
348 meshType_ =
"unstructured";
350 meshUnstructured->buildP2ofP1MeshEdge( meshUnstructuredP1 );
351 mesh_ = meshUnstructured;
354template <
class SC,
class LO,
class GO,
class NO>
359 dim_ = domainP1->dim_;
360 FEType_ = domainP1->FEType_;
362 numProcsCoarseSolve_ = 0;
365 meshType_ = domainP1->meshType_;
367 mesh_ = domainP1->mesh_;
380template <
class SC,
class LO,
class GO,
class NO>
387template <
class SC,
class LO,
class GO,
class NO>
390 MeshUnstrPtr_Type outputMesh = Teuchos::rcp(
new MeshUnstr_Type( comm_) );
392 outputMesh->dim_ = this->dim_ ;
393 outputMesh->FEType_ = this->FEType_ ;
395 outputMesh->mapUnique_ = map;
396 outputMesh->mapRepeated_ = map;
401template <
class SC,
class LO,
class GO,
class NO>
404 MeshUnstrPtr_Type meshUnstructured = Teuchos::rcp_dynamic_cast<MeshUnstr_Type>( mesh_ );
409template <
class SC,
class LO,
class GO,
class NO>
412 if(correctSurfaceNormals)
413 mesh_->correctNormalDirections();
415 if(correctElementOrientation)
416 mesh_->correctElementOrientation();
422template <
class SC,
class LO,
class GO,
class NO>
428template <
class SC,
class LO,
class GO,
class NO>
434template <
class SC,
class LO,
class GO,
class NO>
439template <
class SC,
class LO,
class GO,
class NO>
442 return mesh_->getMapUnique();
445template <
class SC,
class LO,
class GO,
class NO>
448 return mesh_->getMapRepeated();
451template <
class SC,
class LO,
class GO,
class NO>
454 return mesh_->getElementMap();
457template <
class SC,
class LO,
class GO,
class NO>
460 return mesh_->getEdgeMap();
463template <
class SC,
class LO,
class GO,
class NO>
466 return mesh_->getPointsRepeated();
469template <
class SC,
class LO,
class GO,
class NO>
472 return mesh_->getPointsUnique();
475template <
class SC,
class LO,
class GO,
class NO>
478 return mesh_->getBCFlagRepeated();
481template <
class SC,
class LO,
class GO,
class NO>
484 return mesh_->getBCFlagUnique();
487template <
class SC,
class LO,
class GO,
class NO>
489 TEUCHOS_TEST_FOR_EXCEPTION(mesh_->getElementsC().is_null(), std::runtime_error,
"Elements is null for this mesh.");
490 return mesh_->getElements();
493template <
class SC,
class LO,
class GO,
class NO>
495 TEUCHOS_TEST_FOR_EXCEPTION(mesh_->getElementsC().is_null(), std::runtime_error,
"Elements is null for this mesh.");
496 return mesh_->getElementsC();
500template <
class SC,
class LO,
class GO,
class NO>
502 if ( mapVecFieldUnique_.is_null() ) {
504 mapVecFieldUnique_ = mapTmp->buildVecFieldMap(dim_);
506 return mapVecFieldUnique_;
509template <
class SC,
class LO,
class GO,
class NO>
511 if ( mapVecFieldRepeated_.is_null() ) {
513 mapVecFieldRepeated_ = mapTmp->buildVecFieldMap(dim_);
515 return mapVecFieldRepeated_;
518template <
class SC,
class LO,
class GO,
class NO>
521 return mesh_->getNumElementsGlobal();
524template <
class SC,
class LO,
class GO,
class NO>
527 return mesh_->getNumElements();
530template <
class SC,
class LO,
class GO,
class NO>
533 return mesh_->getNumPoints(type);
536template <
class SC,
class LO,
class GO,
class NO>
542 for (
int i = 0; i<geometries2DVec_->size(); i++) {
543 notfoundLabel = meshType.compare(geometries2DVec_->at(i));
544 if (notfoundLabel==0) {
550 for (
int i = 0; i<geometries3DVec_->size(); i++) {
551 notfoundLabel = meshType.compare(geometries3DVec_->at(i));
552 if (notfoundLabel==0) {
558 TEUCHOS_TEST_FOR_EXCEPTION(
true,std::logic_error,
"Select valid geometry.");
564template <
class SC,
class LO,
class GO,
class NO>
567 MeshUnstrPtr_Type meshUnstructured = Teuchos::rcp_dynamic_cast<MeshUnstr_Type>( mesh_ );
568 MeshUnstrPtr_Type meshUnstructuredOther = Teuchos::rcp_dynamic_cast<MeshUnstr_Type>( domainOther->mesh_ );
569 meshUnstructured->buildMeshInterfaceParallelAndDistance( meshUnstructuredOther, interfaceID_vec, distancesToInterface_ );
574template <
class SC,
class LO,
class GO,
class NO>
579 MeshUnstrPtr_Type meshUnstructured = Teuchos::rcp_dynamic_cast<MeshUnstr_Type>( mesh_ );
588 vec3D_GO_ptr_Type indicesGlobalMatched = meshUnstructured->meshInterface_->getIndicesGlobalMatched();
594 vec2D_dbl_ptr_Type sourceNodesRep = meshUnstructured->getPointsRepeated();
597 int numberInterfaceNodes = 0;
598 for(
int i = 0; i < indicesGlobalMatched->size(); i++)
600 for(
int j = 0; j < indicesGlobalMatched->at(i).at(0).size(); j++)
602 numberInterfaceNodes = numberInterfaceNodes + 1;
607 vec2D_dbl_ptr_Type endNodesRep(
new vec2D_dbl_Type( numberInterfaceNodes, vec_dbl_Type( dim_, 0.0 ) ) );
609 int globalIDOfInterfaceNode;
610 for(
int i = 0; i < indicesGlobalMatched->size(); i++)
612 for(
int j = 0; j < indicesGlobalMatched->at(i).at(0).size(); j++)
615 globalIDOfInterfaceNode = indicesGlobalMatched->at(i).at(0).at(j);
617 for(
int k = 0; k < dim_; k++)
619 endNodesRep->at(counter).at(k) = meshUnstructured->getPointsRepeated()->at( globalIDOfInterfaceNode ).at( k );
622 counter = counter + 1;
628 vec_dbl_ptr_Type tempVec(
new vec_dbl_Type( meshUnstructured->getPointsRepeated()->size(), 1000.0 ) );
629 distancesToInterface_ = tempVec;
632 double distance = 0.0;
633 for(
int i = 0; i < sourceNodesRep->size(); i++)
635 for(
int j = 0; j < endNodesRep->size(); j++)
637 for(
int k = 0; k < dim_; k++)
639 distance = distance + std::pow( sourceNodesRep->at(i).at(k) - endNodesRep->at(j).at(k), 2.0 );
643 distance = std::sqrt(distance);
645 if(distancesToInterface_->at(i) > distance)
647 distancesToInterface_->at(i) = distance;
657template <
class SC,
class LO,
class GO,
class NO>
659 return distancesToInterface_;
662template <
class SC,
class LO,
class GO,
class NO>
665 mesh_->setReferenceConfiguration();
668template <
class SC,
class LO,
class GO,
class NO>
673template <
class SC,
class LO,
class GO,
class NO>
675 MeshConstPtr_Type meshConst = mesh_;
679template <
class SC,
class LO,
class GO,
class NO>
682 mesh_->moveMesh(displacementUnique, displacementRepeated);
686template <
class SC,
class LO,
class GO,
class NO>
692 MeshUnstrPtr_Type meshUnstructured = Teuchos::rcp_dynamic_cast<MeshUnstr_Type>( this->
getMesh() );
694 vec3D_GO_ptr_Type indicesGlobalMatchedOrigin = meshUnstructured->getMeshInterface()->getIndicesGlobalMatchedOrigin();
697 GO localInterfaceID = 0;
701 vec_GO_Type vecInterfaceMap;
710 for(
int i = 0; i < indicesGlobalMatchedOrigin->size(); i++)
712 for(
int j = 0; j < indicesGlobalMatchedOrigin->at(i).at(0).size(); j++)
715 GO globalIDOfInterfaceNode = indicesGlobalMatchedOrigin->at(i).at(0).at(j);
717 if( this->
getMapUnique()->getLocalElement(globalIDOfInterfaceNode) != Teuchos::OrdinalTraits<LO>::invalid())
720 vecInterfaceMap.push_back(localInterfaceID);
723 localInterfaceID = localInterfaceID + 1;
729 GO numberInterfaceNodes = localInterfaceID;
732 Teuchos::ArrayView<GO> vecInterfaceMapArray = Teuchos::arrayViewFromVector( vecInterfaceMap );
733 interfaceMapUnique_ = Teuchos::rcp(
new Map_Type( numberInterfaceNodes, vecInterfaceMapArray, 0, comm_ ) );
735 interfaceMapVecFieldUnique_ = interfaceMapUnique_->buildVecFieldMap(dim_);
738template <
class SC,
class LO,
class GO,
class NO>
741 return interfaceMapUnique_;
745template <
class SC,
class LO,
class GO,
class NO>
748 return interfaceMapVecFieldUnique_;
752template <
class SC,
class LO,
class GO,
class NO>
755 return globalInterfaceMapUnique_;
759template <
class SC,
class LO,
class GO,
class NO>
762 return globalInterfaceMapVecFieldUnique_;
765template <
class SC,
class LO,
class GO,
class NO>
768 return otherGlobalInterfaceMapVecFieldUnique_;
771template <
class SC,
class LO,
class GO,
class NO>
774 MeshUnstrPtr_Type meshUnstructured = Teuchos::rcp_dynamic_cast<MeshUnstr_Type>( this->
getMesh() );
775 meshUnstructured->getMeshInterface()->setPartialCoupling(flag, type);
779template <
class SC,
class LO,
class GO,
class NO>
782 MeshUnstrPtr_Type meshUnstructured = Teuchos::rcp_dynamic_cast<MeshUnstr_Type>( this->
getMesh() );
783 MeshInterfacePtr_Type
interface = meshUnstructured->getMeshInterface();
784 vec3D_GO_ptr_Type indicesMatchedUni = interface->getIndicesGlobalMatchedUnique();
786 vec3D_GO_ptr_Type indicesMatchedGlobalSerial = interface->getIndicesGlobalMatchedOrigin();
790 vec_GO_Type vecGlobalInterfaceID(0);
791 vec_GO_Type vecOtherGlobalInterfaceID(0);
792 vec_GO_Type vecInterfaceID(0);
793 vec_int_Type vecInterfaceFlag(0);
796 for(
int i = 0; i < indicesMatchedGlobalSerial->size(); i++)
798 for(
int j = 0; j < indicesMatchedGlobalSerial->at(i).at(0).size(); j++) {
799 LO index = mapUni->getLocalElement( indicesMatchedGlobalSerial->at(i).at(0).at(j) );
800 if ( index != Teuchos::OrdinalTraits<LO>::invalid() ){
801 vecGlobalInterfaceID.push_back( indicesMatchedGlobalSerial->at(i).at(0).at(j) );
802 vecOtherGlobalInterfaceID.push_back( indicesMatchedGlobalSerial->at(i).at(1).at(j) );
803 vecInterfaceID.push_back( (GO) localID );
804 vecInterfaceFlag.push_back( (*flagPointsUni)[index] );
811 Teuchos::ArrayView<GO> vecInterfaceGlobalMapArray = Teuchos::arrayViewFromVector( vecGlobalInterfaceID );
812 Teuchos::ArrayView<GO> vecInterfaceMapArray = Teuchos::arrayViewFromVector( vecInterfaceID );
813 Teuchos::ArrayView<GO> vecOtherInterfaceGlobalMapArray = Teuchos::arrayViewFromVector( vecOtherGlobalInterfaceID );
815 globalInterfaceMapUnique_ = Teuchos::rcp(
new Map_Type( -1, vecInterfaceGlobalMapArray, 0, comm_ ) );
816 interfaceMapUnique_ = Teuchos::rcp(
new Map_Type(-1, vecInterfaceMapArray, 0, comm_ ) );
818 otherGlobalInterfaceMapUnique_ = Teuchos::rcp(
new Map_Type(-1, vecOtherInterfaceGlobalMapArray, 0, comm_ ) );
821 if ( interface->sizePartialCoupling() == 0 ) {
822 globalInterfaceMapVecFieldUnique_ = globalInterfaceMapUnique_->buildVecFieldMap(dim_);
823 interfaceMapVecFieldUnique_ = interfaceMapUnique_->buildVecFieldMap(dim_);
824 otherGlobalInterfaceMapVecFieldUnique_ = otherGlobalInterfaceMapUnique_->buildVecFieldMap(dim_);
828 if (this->comm_->getRank() == 0)
829 std::cout <<
"-- ### Warning! Unique and unique-vector-field map might not be compatiable due to partial coupling conditions. ### --" << std::endl;
832 Teuchos::ArrayView<const GO> elementListGlobal = globalInterfaceMapUnique_->getNodeElementList();
833 Teuchos::ArrayView<const GO> otherElementListGlobal = otherGlobalInterfaceMapUnique_->getNodeElementList();
835 Teuchos::Array<GO> elementListFieldGlobal( 0 );
836 Teuchos::Array<GO> elListFieldPartial( 0 );
838 Teuchos::Array<GO> otherElementListFieldGlobal( 0 );
839 Teuchos::Array<GO> otherElListFieldPartial( 0 );
841 for (UN i=0; i<elementListGlobal.size(); i++) {
842 int loc = interface->isPartialCouplingFlag( vecInterfaceFlag[i] );
844 std::string partialType = interface->getPartialCouplingType( loc );
845 if (partialType ==
"X_Y" && dim_ == 3) {
846 elementListFieldGlobal.push_back (numDofs * elementListGlobal[i] + 0 );
847 elementListFieldGlobal.push_back (numDofs * elementListGlobal[i] + 1 );
848 elementListFieldGlobal.push_back (numDofs * elementListGlobal[i] + 2 );
849 elListFieldPartial.push_back (numDofs * elementListGlobal[i] + 0 );
850 elListFieldPartial.push_back (numDofs * elementListGlobal[i] + 1 );
852 otherElementListFieldGlobal.push_back (numDofs * otherElementListGlobal[i] + 0 );
853 otherElementListFieldGlobal.push_back (numDofs * otherElementListGlobal[i] + 1 );
854 otherElementListFieldGlobal.push_back (numDofs * otherElementListGlobal[i] + 2 );
855 otherElListFieldPartial.push_back (numDofs * otherElementListGlobal[i] + 0 );
856 otherElListFieldPartial.push_back (numDofs * otherElementListGlobal[i] + 1 );
860 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::runtime_error,
"Implement other partial coupling types.");
863 for (UN dof=0; dof<numDofs; dof++){
864 elementListFieldGlobal.push_back( numDofs * elementListGlobal[i] + dof );
865 elListFieldPartial.push_back ( numDofs * elementListGlobal[i] + dof );
866 otherElementListFieldGlobal.push_back( numDofs * otherElementListGlobal[i] + dof );
867 otherElListFieldPartial.push_back ( numDofs * otherElementListGlobal[i] + dof );
871 globalInterfaceMapVecFieldUnique_ = Teuchos::rcp(
new Map_Type( -1, elementListFieldGlobal(), 0, this->
getComm() ) );
872 otherGlobalInterfaceMapVecFieldUnique_ = Teuchos::rcp(
new Map_Type( -1, otherElementListFieldGlobal(), 0, this->
getComm() ) );
874 interfaceMapVecFieldUnique_ = Teuchos::rcp(
new Map_Type(-1, elementListFieldGlobal.size(), 0, this->getComm() ) );
876 partialGlobalInterfaceVecFieldMap_ = Teuchos::rcp(
new Map_Type( -1, elListFieldPartial(), 0, this->
getComm() ) );
877 otherPartialGlobalInterfaceVecFieldMap_ = Teuchos::rcp(
new Map_Type(-1, otherElListFieldPartial(), 0, this->
getComm() ) );
883template <
class SC,
class LO,
class GO,
class NO>
886 nodeID = (GO) (dofID/dim);
887 localDofNumber = (LO) (dofID%dim);
890template <
class SC,
class LO,
class GO,
class NO>
893 dofID = (GO) ( dim * nodeID + localDofNumber);
896template <
class SC,
class LO,
class GO,
class NO>
899 return vecLocalInterfaceIDinGlobal_;
902template <
class SC,
class LO,
class GO,
class NO>
905 MeshUnstrPtr_Type meshUnstructured = Teuchos::rcp(
new MeshUnstr_Type(comm_, 10));
906 mesh_ = meshUnstructured;
908 this->dim_ = domain->getDimension();
909 this->mesh_->mapUnique_ = Teuchos::rcp_const_cast<Map_Type>( domain->getInterfaceMapUnique() );
910 this->mesh_->mapRepeated_ = Teuchos::rcp_const_cast<Map_Type>( domain->getInterfaceMapUnique() );
911 this->mapVecFieldRepeated_ = Teuchos::rcp_const_cast<Map_Type>( domain->getInterfaceMapVecFieldUnique() );
912 this->mapVecFieldUnique_ = Teuchos::rcp_const_cast<Map_Type>( domain->getInterfaceMapVecFieldUnique() );
914 MapConstPtr_Type mapGI = domain->getGlobalInterfaceMapUnique();
915 MapConstPtr_Type mapD = domain->getMapUnique();
916 this->mesh_->pointsRep_.reset(
new std::vector<std::vector<SC> >(mapGI->getNodeNumElements(), std::vector<SC>(this->dim_, 0.0 ) ) );
917 this->mesh_->pointsUni_.reset(
new std::vector<std::vector<SC> >(mapGI->getNodeNumElements(), std::vector<SC>(this->dim_, 0.0 ) ) );
918 vec2D_dbl_ptr_Type pointsUni = domain->getPointsUnique();
919 for (
int i=0; i<mapGI->getNodeNumElements(); i++) {
920 LO index = mapD->getLocalElement( mapGI->getGlobalElement( i ) );
921 for (
int j=0; j<this->dim_; j++){
922 (*this->mesh_->pointsRep_)[i][j] = (*pointsUni)[index][j];
923 (*this->mesh_->pointsUni_)[i][j] = (*pointsUni)[index][j];
933template <
class SC,
class LO,
class GO,
class NO>
936 double eps = 0.0000001;
941 auto iterator = std::find_if( points->begin(), points->end(),
942 [&] (
const std::vector<double>& a){
943 if (a[0] >= x[0]-eps && a[0] <= x[0]+eps
944 && a[1] >= x[1]-eps && a[1] <= x[1]+eps)
950 if ( iterator != points->end() )
951 return std::distance(points->begin(),iterator);
956 auto iterator = std::find_if(points->begin(),points->end(),
957 [&] (
const std::vector<double>& a){
958 if (a[0] >= x[0]-eps && a[0] <= x[0]+eps
959 && a[1] >= x[1]-eps && a[1] <= x[1]+eps
960 && a[2] >= x[2]-eps && a[2] <= x[2]+eps)
966 if ( iterator != points->end() )
967 return std::distance(points->begin(),iterator);
974template <
class SC,
class LO,
class GO,
class NO>
978 MultiVectorPtr_Type nodeList = Teuchos::rcp(
new MultiVector_Type ( map, dim_ ) );
980 for (
int i=0; i<nodeList->getLocalLength(); i++) {
981 for (
int j=0; j<dim_; j++) {
982 Teuchos::ArrayRCP< SC > values = nodeList->getDataNonConst( j );
983 values[i] = (*pointsRepeated)[i][j];
989template <
class SC,
class LO,
class GO,
class NO>
997 Teuchos::ArrayRCP< SC > entries = exportSolution->getDataNonConst(0);
998 for(
int i=0; i< entries.size(); i++){
999 entries[i] = BCFlags->at(i);
1002 Teuchos::RCP<const MultiVector<SC,LO,GO,NO> > exportSolutionConst = exportSolution;
1004 exPara->setup(
"Mesh_Node_Flags_"+name,this->
getMesh(), this->FEType_);
1006 exPara->addVariable(exportSolutionConst,
"Flags",
"Scalar", 1,this->
getMapUnique());
1009 exPara->closeExporter();
1012template <
class SC,
class LO,
class GO,
class NO>
1018 exportSolution->putScalar(0.);
1021 Teuchos::ArrayRCP< SC > entries = exportSolution->getDataNonConst(0);
1024 for (UN T=0; T<elementsC->numberElements(); T++) {
1026 ElementsPtr_Type subEl = fe.getSubElements();
1027 for (
int surface=0; surface<fe.numSubElements(); surface++) {
1029 vec_int_Type nodeListElement = fe.getVectorNodeList();
1030 if(subEl->getDimension() == dim_-1 ){
1031 vec_int_Type nodeList = feSub.getVectorNodeListNonConst();
1033 vec_dbl_Type v_E(dim_,1.);
1038 for(
int j=0; j< nodeList.size(); j++){
1039 for(
int i=0; i< this->dim_; i++){
1042 entries[
id*this->dim_+i] = 1./norm_v_E * v_E[i];
1050 Teuchos::RCP<const MultiVector<SC,LO,GO,NO> > exportSolutionConst = exportSolution;
1052 exPara->setup(
"Mesh_Surface_Directions_"+name,this->
getMesh(), this->FEType_);
1054 exPara->addVariable(exportSolutionConst,
"SurfaceNormals",
"Vector", this->dim_,this->
getMapUnique());
1057 exPara->closeExporter();
1060template <
class SC,
class LO,
class GO,
class NO>
1066 exportSolution->putScalar(0.);
1069 Teuchos::ArrayRCP< SC > entries = exportSolution->getDataNonConst(0);
1075 for (UN T=0; T<elementsC->numberElements(); T++) {
1077 detB = B.computeInverse(Binv);
1081 Teuchos::RCP<const MultiVector<SC,LO,GO,NO> > exportSolutionConst = exportSolution;
1083 exPara->setup(
"Mesh_Element_Orientation_"+name,this->
getMesh(),
"P0");
1085 exPara->addVariable(exportSolutionConst,
"VolElement",
"Scalar", 1,this->
getElementMap());
1088 exPara->closeExporter();
1092template <
class SC,
class LO,
class GO,
class NO>
1099 Teuchos::ArrayRCP< SC > entries = exportSolution->getDataNonConst(0);
1102 for(
int i=0; i< entries.size(); i++){
1103 entries[i] = elements->getElement(i).getFlag();
1106 Teuchos::RCP<const MultiVector<SC,LO,GO,NO> > exportSolutionConst = exportSolution;
1108 exPara->setup(
"Mesh_Element_Flags_"+name,this->
getMesh(),
"P0");
1110 exPara->addVariable(exportSolutionConst,
"Flags",
"Scalar", 1,this->
getElementMap());
1114 exPara->closeExporter();
vec_int_ptr_Type getElementsFlag() const
Returns flags of elements as vector of type int.
Definition Domain_def.hpp:171
UN getDimension() const
Get dimension.
Definition Domain_def.hpp:423
void initDummyMesh(MapPtr_Type map)
Initialize dummy mesh for i.e. lagrange multiplier that only represents on 'point' in that sense....
Definition Domain_def.hpp:388
void exportSurfaceNormals(std::string name="default")
Exporting Paraview file displaying surface normals of the underlying mesh. As we are generally not ab...
Definition Domain_def.hpp:1013
MapConstPtr_Type getMapRepeated() const
Get map of all repeated (not uniquely distributed) nodes of processors.
Definition Domain_def.hpp:446
void preProcessMesh(bool correctSurfaceNormals, bool correctElementDirection)
Option of preprocessing mesh by making consistent outward normal and/or consistent element orientatio...
Definition Domain_def.hpp:410
CommConstPtr_Type getComm() const
Communicator.
Definition Domain_def.hpp:435
vec_int_ptr_Type getBCFlagUnique() const
Get vector of the flags corrsponding to the unique points (on your processor)
Definition Domain_def.hpp:482
MapConstPtr_Type getMapVecFieldRepeated() const
Definition Domain_def.hpp:510
void partitionDistanceToInterface()
void buildMesh(int flags, std::string meshType, int dim, std::string FEType, int N, int M, int numProcsCoarseSolve=0)
Build structured mesh in FEDDLib.
Definition Domain_def.hpp:204
vec2D_int_ptr_Type getElements() const
Get the elements (on your processor) as vector data type.
Definition Domain_def.hpp:488
void setPartialCoupling(int flag, std::string type)
Set partial coupling.
Definition Domain_def.hpp:772
MeshPtr_Type getMesh()
Get mesh.
Definition Domain_def.hpp:669
void buildInterfaceMaps()
Build interface maps.
Definition Domain_def.hpp:780
void identifyInterfaceParallelAndDistance(DomainPtr_Type domainOther, vec_int_Type interfaceID_vec)
Itentify interface parallal and distance.
Definition Domain_def.hpp:565
void toDofID(UN dim, GO nodeID, LO localDofNumber, GO &dofID)
Hilfsfunktion fuer buildLocalInterfaceIDInGlobal(). Gibt fuer eine gegebene nodeID die entsprechende ...
Definition Domain_def.hpp:891
vec_long_Type getLocalInterfaceIDInGlobal() const
Get local interface id in global.
Definition Domain_def.hpp:897
void readMeshSize(std::string filename, std::string delimiter)
Reading mesh size.
Definition Domain_def.hpp:283
void buildUniqueInterfaceMaps()
Build unique node and dof interfaceMap in interface numbering.
Definition Domain_def.hpp:687
void partitionMesh(bool partitionDistance=false)
Partition mesh according to number of processors. Partition with parmetis.
Definition Domain_def.hpp:294
MapConstPtr_Type getMapUnique() const
MultiVectorPtr_Type getNodeListMV() const
Get node list in multi vector point.
Definition Domain_def.hpp:975
MapConstPtr_Type getOtherGlobalInterfaceMapVecFieldUnique() const
Get other interface vec field map unique (for fsi coupling block c4)
Definition Domain_def.hpp:766
LO getNumElements() const
Get local number of elements (on your processor)
Definition Domain_def.hpp:525
void setMesh(MeshUnstrPtr_Type meshUnstr)
Settng mesh from domain.
Definition Domain_def.hpp:381
ElementsPtr_Type getElementsC() const
Get the elements (on your processor) as Elements_Type.
Definition Domain_def.hpp:494
void toNodeID(UN dim, GO dofID, GO &nodeID, LO &localDofNumber)
Hilfsfunktion fuer buildLocalInterfaceIDInGlobal(). Gibt fuer eine gegebene nodeID die entsprechende ...
Definition Domain_def.hpp:884
int findInPointsUnique(const vec_dbl_Type &x) const
Find in points unique.
Definition Domain_def.hpp:934
int checkGeomentry(std::string MeshType, int dim) const
Domain()
Constructor.
Definition Domain_def.hpp:16
vec2D_dbl_ptr_Type getPointsRepeated() const
Get vector of repeated points (on your processor). 2D Vector with size: numPoints x dim.
Definition Domain_def.hpp:464
void initializeFEData()
initializeFEData
Definition Domain_def.hpp:165
void moveMesh(MultiVectorPtr_Type displacementUnique, MultiVectorPtr_Type displacementRepeated)
Move mesh according to displacement (i.e. used in FSI)
Definition Domain_def.hpp:680
std::string getFEType() const
Finite element discretization. Represented as string, i.e., P2.
Definition Domain_def.hpp:429
LO getNumPoints(std::string type="Unique") const
Get local number of points of type 'type' (unique/repeated)
Definition Domain_def.hpp:531
void initializeUnstructuredMesh(int dimension, std::string feType, int volumeID=10)
Generally the domain object holds only meshes from type 'Mesh'. If we read a mesh from file it become...
Definition Domain_def.hpp:269
MapConstPtr_Type getEdgeMap() const
Get map of edges.
Definition Domain_def.hpp:458
GO getNumElementsGlobal() const
Get global number of elements.
Definition Domain_def.hpp:519
void initWithDomain(DomainPtr_Type domainsP1)
Initialize domain with already existing domain.
Definition Domain_def.hpp:355
void exportElementFlags(std::string name="default")
Exporting Paraview file displaying element flags of the underlying mesh.
Definition Domain_def.hpp:1093
MapConstPtr_Type getGlobalInterfaceMapUnique() const
Get interface map unique (for fsi coupling block c4)
Definition Domain_def.hpp:753
void buildP2ofP1Domain(DomainPtr_Type domainP1)
Building a P2 mesh from the P1 one mesh. We generally habe P1-input meshes and build the P2 mesh on t...
Definition Domain_def.hpp:336
vec2D_dbl_ptr_Type getPointsUnique() const
Get vector of unique points (on your processor). 2D Vector with size: numPoints x dim.
Definition Domain_def.hpp:470
void exportNodeFlags(std::string name="default")
Exporting Paraview file displaying node flags of the underlying mesh.
Definition Domain_def.hpp:990
MapConstPtr_Type getInterfaceMapVecFieldUnique() const
Get interface vector field map unique.
Definition Domain_def.hpp:746
void exportElementOrientation(std::string name="default")
Exporting Paraview file displaying element volume of underlying mesh.
Definition Domain_def.hpp:1061
void info() const
Information about the domain.
Definition Domain_def.hpp:141
MapConstPtr_Type getElementMap() const
Get map of elements.
Definition Domain_def.hpp:452
vec_int_ptr_Type getBCFlagRepeated() const
Get vector of the flags corrsponding to the repeated points (on your processor)
Definition Domain_def.hpp:476
void setReferenceConfiguration()
Set reference configuration.
Definition Domain_def.hpp:663
MapConstPtr_Type getGlobalInterfaceMapVecFieldUnique() const
Get interface vec field map unique (for fsi coupling block c4)
Definition Domain_def.hpp:760
LO getApproxEntriesPerRow() const
Estimate depending on FEType and dimension for the numer of entries in system matrix,...
Definition Domain_def.hpp:177
vec_dbl_ptr_Type getDistancesToInterface() const
Get distances to interface.
Definition Domain_def.hpp:658
void exportMesh(bool exportEdges=false, bool exportSurfaces=false, std::string exportMesh="export.mesh")
Exporting Mesh.
Definition Domain_def.hpp:402
MapConstPtr_Type getInterfaceMapUnique() const
Get interface map unique.
Definition Domain_def.hpp:739
void setDummyInterfaceDomain(DomainPtr_Type domain)
Set dummy interface domain.
Definition Domain_def.hpp:903
void calculateDistancesToInterface()
Calculate distance to interface.
Definition Domain_def.hpp:575
void readAndPartitionMesh(std::string filename, std::string delimiter, int dim, std::string FEType, int volumeID=10)
Function called when mesh is read and paritioned. In turn it calls readMesh(...) and partitionMesh(....
Definition Domain_def.hpp:319
MapConstPtr_Type getMapVecFieldUnique() const
Get map of all unique (not uniquely distributed) nodes of processors in a vector field point of view....
Definition Domain_def.hpp:501
Definition ExporterParaView_decl.hpp:44
Definition FiniteElement.hpp:17
static void buildTransformation(const vec_int_Type &element, vec2D_dbl_ptr_Type pointsRep, SmallMatrix< SC > &B, std::string FEType="P")
Build transformation of element to reference element depending on FEType.
Definition Helper.cpp:138
static void computeSurfaceNormal(int dim, vec2D_dbl_ptr_Type pointsRep, vec_int_Type nodeList, vec_dbl_Type &v_E, double &norm_v_E)
Compute surface normal of corresponding surface.
Definition Helper.cpp:103
Definition MultiVector_decl.hpp:36
This class represents a templated small Matrix of type T. Primarily created for 2x2 and 3x3 matrices....
Definition SmallMatrix.hpp:22
Adaptive Mesh Refinement.
Definition AdaptiveMeshRefinement_decl.hpp:33