14template <
class SC,
class LO,
class GO,
class NO>
19mapVecFieldRepeated_(),
22distancesToInterface_(),
24interfaceMapVecFieldUnique_(),
25globalInterfaceMapUnique_(),
26globalInterfaceMapVecFieldUnique_(),
27partialGlobalInterfaceVecFieldMap_(),
28otherGlobalInterfaceMapUnique_(),
29otherGlobalInterfaceMapVecFieldUnique_(),
30otherPartialGlobalInterfaceVecFieldMap_()
35template <
class SC,
class LO,
class GO,
class NO>
40mapVecFieldRepeated_(),
43distancesToInterface_(),
45interfaceMapVecFieldUnique_(),
46globalInterfaceMapUnique_(),
47globalInterfaceMapVecFieldUnique_(),
48partialGlobalInterfaceVecFieldMap_(),
49otherGlobalInterfaceMapUnique_(),
50otherGlobalInterfaceMapVecFieldUnique_(),
51otherPartialGlobalInterfaceVecFieldMap_()
56template <
class SC,
class LO,
class GO,
class NO>
62mapVecFieldRepeated_(),
65distancesToInterface_(),
67interfaceMapVecFieldUnique_(),
68globalInterfaceMapUnique_(),
69globalInterfaceMapVecFieldUnique_(),
70partialGlobalInterfaceVecFieldMap_(),
71otherGlobalInterfaceMapUnique_(),
72otherGlobalInterfaceMapVecFieldUnique_(),
73otherPartialGlobalInterfaceVecFieldMap_()
79template <
class SC,
class LO,
class GO,
class NO>
84mapVecFieldRepeated_(),
87distancesToInterface_(),
89interfaceMapVecFieldUnique_(),
90globalInterfaceMapUnique_(),
91globalInterfaceMapVecFieldUnique_(),
92partialGlobalInterfaceVecFieldMap_(),
93 otherGlobalInterfaceMapUnique_(),
94 otherGlobalInterfaceMapVecFieldUnique_(),
95 otherPartialGlobalInterfaceVecFieldMap_()
102 geometries2DVec_.reset(
new string_vec_Type(0));
103 geometries2DVec_->push_back(
"Square");
104 geometries2DVec_->push_back(
"BFS");
106 geometries2DVec_->push_back(
"structuredMiniTest");
111template <
class SC,
class LO,
class GO,
class NO>
116mapVecFieldRepeated_(),
119distancesToInterface_(),
120interfaceMapUnique_(),
121interfaceMapVecFieldUnique_(),
122globalInterfaceMapUnique_(),
123globalInterfaceMapVecFieldUnique_(),
124partialGlobalInterfaceVecFieldMap_()
131 geometries3DVec_.reset(
new string_vec_Type(0));
132 geometries3DVec_->push_back(
"Square");
133 geometries3DVec_->push_back(
"BFS");
134 geometries3DVec_->push_back(
"Square5Element");
139template <
class SC,
class LO,
class GO,
class NO>
144 LO numberNodes = this->
getMapUnique()->getNodeNumElements();
145 Teuchos::reduceAll( *this->comm_, Teuchos::REDUCE_MIN, numberNodes, Teuchos::ptrFromRef(minNumberNodes) );
146 Teuchos::reduceAll( *this->comm_, Teuchos::REDUCE_MAX, numberNodes, Teuchos::ptrFromRef(maxNumberNodes) );
148 bool verbose(comm_->getRank()==0);
150 std::cout <<
"\t### Domain ###" << std::endl;
151 std::cout <<
"\t### Dimension: "<< dim_ << std::endl;
152 std::cout <<
"\t### Mesh type: "<< meshType_ << std::endl;
153 std::cout <<
"\t### Mesh flags: "<< flagsOption_ << std::endl;
154 std::cout <<
"\t### Subdomains: "<< n_ << std::endl;
155 std::cout <<
"\t### H/h: "<< m_ << std::endl;
156 std::cout <<
"\t### FE type: "<< FEType_ << std::endl;
157 std::cout <<
"\t### Number Nodes: "<< mesh_->getMapUnique()->getMaxAllGlobalIndex()+1 << std::endl;
158 std::cout <<
"\t### Minimum number of nodes: "<< minNumberNodes <<
" Maximum number of nodes: " << maxNumberNodes << std::endl;
159 std::cout <<
"\t### Empty ranks for coarse solves: "<< numProcsCoarseSolve_ << std::endl;
163template <
class SC,
class LO,
class GO,
class NO>
169template <
class SC,
class LO,
class GO,
class NO>
171 return mesh_->getElementsFlag();
175template <
class SC,
class LO,
class GO,
class NO>
177 if (this->dim_ == 2) {
178 if ( this->FEType_ ==
"P1" ) {
181 else if ( this->FEType_ ==
"P2" ) {
188 if ( this->FEType_ ==
"P1" ) {
191 else if ( this->FEType_ ==
"P2" ) {
202template <
class SC,
class LO,
class GO,
class NO>
207#ifdef ASSERTS_WARNINGS
208 MYASSERT(geoNumber!=-1,
"Geometry not known for this Dimension.")
211 MeshStrPtr_Type meshStructured = Teuchos::rcp(
new MeshStr_Type(comm_));
216 numProcsCoarseSolve_ = numProcsCoarseSolve;
217 meshType_ = meshType;
218 flagsOption_ = flagsOption;
224 meshStructured->setGeometry2DRectangle(coorRec, length, height);
225 meshStructured->buildMesh2D(FEType, n_, m_, numProcsCoarseSolve);
228 meshStructured->setGeometry2DRectangle(coorRec, length, height);
229 meshStructured->buildMesh2DBFS(FEType, n_, m_, numProcsCoarseSolve);
232 TEUCHOS_TEST_FOR_EXCEPTION(
true,std::logic_error,
"Select valid mesh. Structured types are 'structured' and 'structured_bfs' in 2D.");
240 meshStructured->setGeometry3DBox(coorRec, length, width, height);
241 meshStructured->buildMesh3D( FEType, n_, m_, numProcsCoarseSolve);
244 meshStructured->setGeometry3DBox(coorRec, length, width, height);
245 meshStructured->buildMesh3DBFS( FEType, n_, m_, numProcsCoarseSolve);
248 meshStructured->setGeometry3DBox(coorRec, length, width, height);
249 meshStructured->buildMesh3D5Elements( FEType, n_, m_, numProcsCoarseSolve);
252 TEUCHOS_TEST_FOR_EXCEPTION(
true,std::runtime_error,
"Select valid mesh. Structured types are 'structured' and 'structured_bfs' in 3D." );
257 TEUCHOS_TEST_FOR_EXCEPTION(
true,std::logic_error,
"Select valid mesh dimension. 2 or 3 dimensional meshes can be constructed.");
260 meshStructured->buildElementMap();
261 meshStructured->setStructuredMeshFlags(flagsOption,FEType);
262 meshStructured->buildSurfaces(flagsOption,FEType);
264 mesh_ = meshStructured;
267template <
class SC,
class LO,
class GO,
class NO>
270 MeshUnstrPtr_Type meshUnstructured = Teuchos::rcp(
new MeshUnstr_Type(comm_, volumeID, meshUnit, convertToCM));
271 mesh_ = meshUnstructured;
272 mesh_->dim_ = dimension;
274 meshType_ =
"unstructured";
275 numProcsCoarseSolve_ = 0;
276 n_ = comm_->getSize() - numProcsCoarseSolve_;
281template <
class SC,
class LO,
class GO,
class NO>
284 MeshUnstrPtr_Type meshUnstructured = Teuchos::rcp_dynamic_cast<MeshUnstr_Type>( mesh_ );
285 TEUCHOS_TEST_FOR_EXCEPTION( meshUnstructured.is_null(), std::runtime_error,
"Unstructured Mesh is null." );
287 meshUnstructured->setMeshFileName( filename, delimiter );
288 meshUnstructured->readMeshSize( );
292template <
class SC,
class LO,
class GO,
class NO>
295 MeshUnstrPtr_Type meshUnstructured = Teuchos::rcp_dynamic_cast<MeshUnstr_Type>( mesh_ );
297 if (partitionDistance)
300 mesh_ = meshUnstructured;
304template <
class SC,
class LO,
class GO,
class NO>
307 vec_dbl_Type tmp = *distancesToInterface_;
309 distancesToInterface_.reset(
new vec_dbl_Type ( mesh_->getMapRepeated()->getNodeNumElements() ) );
311 for (UN i=0; i<distancesToInterface_->size(); i++) {
312 GO index = mesh_->getMapRepeated()->getGlobalElement(i);
313 distancesToInterface_->at(i) = tmp[index];
317template <
class SC,
class LO,
class GO,
class NO>
320 MeshUnstrPtr_Type meshUnstructured = Teuchos::rcp(
new MeshUnstr_Type(comm_, volumeID));
325 mesh_ = meshUnstructured;
327 numProcsCoarseSolve_ = 0;
328 n_ = comm_->getSize() - numProcsCoarseSolve_;
331 meshType_ =
"unstructured";
334template <
class SC,
class LO,
class GO,
class NO>
337 MeshUnstrPtr_Type meshUnstructuredP1 = Teuchos::rcp_dynamic_cast<MeshUnstr_Type>( domainP1->mesh_ );
339 MeshUnstrPtr_Type meshUnstructured = Teuchos::rcp(
new MeshUnstr_Type( comm_, meshUnstructuredP1->volumeID_) );
343 dim_ = domainP1->dim_;
345 numProcsCoarseSolve_ = 0;
347 meshType_ =
"unstructured";
349 meshUnstructured->buildP2ofP1MeshEdge( meshUnstructuredP1 );
350 mesh_ = meshUnstructured;
353template <
class SC,
class LO,
class GO,
class NO>
358 dim_ = domainP1->dim_;
359 FEType_ = domainP1->FEType_;
361 numProcsCoarseSolve_ = 0;
364 meshType_ = domainP1->meshType_;
366 mesh_ = domainP1->mesh_;
379template <
class SC,
class LO,
class GO,
class NO>
386template <
class SC,
class LO,
class GO,
class NO>
389 MeshUnstrPtr_Type outputMesh = Teuchos::rcp(
new MeshUnstr_Type( comm_) );
391 outputMesh->dim_ = this->dim_ ;
392 outputMesh->FEType_ = this->FEType_ ;
394 outputMesh->mapUnique_ = map;
395 outputMesh->mapRepeated_ = map;
400template <
class SC,
class LO,
class GO,
class NO>
403 MeshUnstrPtr_Type meshUnstructured = Teuchos::rcp_dynamic_cast<MeshUnstr_Type>( mesh_ );
408template <
class SC,
class LO,
class GO,
class NO>
411 if(correctSurfaceNormals)
412 mesh_->correctNormalDirections();
414 if(correctElementOrientation)
415 mesh_->correctElementOrientation();
421template <
class SC,
class LO,
class GO,
class NO>
427template <
class SC,
class LO,
class GO,
class NO>
433template <
class SC,
class LO,
class GO,
class NO>
438template <
class SC,
class LO,
class GO,
class NO>
441 return mesh_->getMapUnique();
444template <
class SC,
class LO,
class GO,
class NO>
447 return mesh_->getMapRepeated();
450template <
class SC,
class LO,
class GO,
class NO>
453 return mesh_->getElementMap();
456template <
class SC,
class LO,
class GO,
class NO>
459 return mesh_->getEdgeMap();
462template <
class SC,
class LO,
class GO,
class NO>
465 return mesh_->getPointsRepeated();
468template <
class SC,
class LO,
class GO,
class NO>
471 return mesh_->getPointsUnique();
474template <
class SC,
class LO,
class GO,
class NO>
477 return mesh_->getBCFlagRepeated();
480template <
class SC,
class LO,
class GO,
class NO>
483 return mesh_->getBCFlagUnique();
486template <
class SC,
class LO,
class GO,
class NO>
488 TEUCHOS_TEST_FOR_EXCEPTION(mesh_->getElementsC().is_null(), std::runtime_error,
"Elements is null for this mesh.");
489 return mesh_->getElements();
492template <
class SC,
class LO,
class GO,
class NO>
494 TEUCHOS_TEST_FOR_EXCEPTION(mesh_->getElementsC().is_null(), std::runtime_error,
"Elements is null for this mesh.");
495 return mesh_->getElementsC();
499template <
class SC,
class LO,
class GO,
class NO>
501 if ( mapVecFieldUnique_.is_null() ) {
503 mapVecFieldUnique_ = mapTmp->buildVecFieldMap(dim_);
505 return mapVecFieldUnique_;
508template <
class SC,
class LO,
class GO,
class NO>
510 if ( mapVecFieldRepeated_.is_null() ) {
512 mapVecFieldRepeated_ = mapTmp->buildVecFieldMap(dim_);
514 return mapVecFieldRepeated_;
517template <
class SC,
class LO,
class GO,
class NO>
520 return mesh_->getNumElementsGlobal();
523template <
class SC,
class LO,
class GO,
class NO>
526 return mesh_->getNumElements();
529template <
class SC,
class LO,
class GO,
class NO>
532 return mesh_->getNumPoints(type);
535template <
class SC,
class LO,
class GO,
class NO>
541 for (
int i = 0; i<geometries2DVec_->size(); i++) {
542 notfoundLabel = meshType.compare(geometries2DVec_->at(i));
543 if (notfoundLabel==0) {
549 for (
int i = 0; i<geometries3DVec_->size(); i++) {
550 notfoundLabel = meshType.compare(geometries3DVec_->at(i));
551 if (notfoundLabel==0) {
557 TEUCHOS_TEST_FOR_EXCEPTION(
true,std::logic_error,
"Select valid geometry.");
563template <
class SC,
class LO,
class GO,
class NO>
566 MeshUnstrPtr_Type meshUnstructured = Teuchos::rcp_dynamic_cast<MeshUnstr_Type>( mesh_ );
567 MeshUnstrPtr_Type meshUnstructuredOther = Teuchos::rcp_dynamic_cast<MeshUnstr_Type>( domainOther->mesh_ );
568 meshUnstructured->buildMeshInterfaceParallelAndDistance( meshUnstructuredOther, interfaceID_vec, distancesToInterface_ );
573template <
class SC,
class LO,
class GO,
class NO>
578 MeshUnstrPtr_Type meshUnstructured = Teuchos::rcp_dynamic_cast<MeshUnstr_Type>( mesh_ );
587 vec3D_GO_ptr_Type indicesGlobalMatched = meshUnstructured->meshInterface_->getIndicesGlobalMatched();
593 vec2D_dbl_ptr_Type sourceNodesRep = meshUnstructured->getPointsRepeated();
596 int numberInterfaceNodes = 0;
597 for(
int i = 0; i < indicesGlobalMatched->size(); i++)
599 for(
int j = 0; j < indicesGlobalMatched->at(i).at(0).size(); j++)
601 numberInterfaceNodes = numberInterfaceNodes + 1;
606 vec2D_dbl_ptr_Type endNodesRep(
new vec2D_dbl_Type( numberInterfaceNodes, vec_dbl_Type( dim_, 0.0 ) ) );
608 int globalIDOfInterfaceNode;
609 for(
int i = 0; i < indicesGlobalMatched->size(); i++)
611 for(
int j = 0; j < indicesGlobalMatched->at(i).at(0).size(); j++)
614 globalIDOfInterfaceNode = indicesGlobalMatched->at(i).at(0).at(j);
616 for(
int k = 0; k < dim_; k++)
618 endNodesRep->at(counter).at(k) = meshUnstructured->getPointsRepeated()->at( globalIDOfInterfaceNode ).at( k );
621 counter = counter + 1;
627 vec_dbl_ptr_Type tempVec(
new vec_dbl_Type( meshUnstructured->getPointsRepeated()->size(), 1000.0 ) );
628 distancesToInterface_ = tempVec;
631 double distance = 0.0;
632 for(
int i = 0; i < sourceNodesRep->size(); i++)
634 for(
int j = 0; j < endNodesRep->size(); j++)
636 for(
int k = 0; k < dim_; k++)
638 distance = distance + std::pow( sourceNodesRep->at(i).at(k) - endNodesRep->at(j).at(k), 2.0 );
642 distance = std::sqrt(distance);
644 if(distancesToInterface_->at(i) > distance)
646 distancesToInterface_->at(i) = distance;
656template <
class SC,
class LO,
class GO,
class NO>
658 return distancesToInterface_;
661template <
class SC,
class LO,
class GO,
class NO>
664 mesh_->setReferenceConfiguration();
667template <
class SC,
class LO,
class GO,
class NO>
672template <
class SC,
class LO,
class GO,
class NO>
674 MeshConstPtr_Type meshConst = mesh_;
678template <
class SC,
class LO,
class GO,
class NO>
681 mesh_->moveMesh(displacementUnique, displacementRepeated);
685template <
class SC,
class LO,
class GO,
class NO>
691 MeshUnstrPtr_Type meshUnstructured = Teuchos::rcp_dynamic_cast<MeshUnstr_Type>( this->
getMesh() );
693 vec3D_GO_ptr_Type indicesGlobalMatchedOrigin = meshUnstructured->getMeshInterface()->getIndicesGlobalMatchedOrigin();
696 GO localInterfaceID = 0;
700 vec_GO_Type vecInterfaceMap;
709 for(
int i = 0; i < indicesGlobalMatchedOrigin->size(); i++)
711 for(
int j = 0; j < indicesGlobalMatchedOrigin->at(i).at(0).size(); j++)
714 GO globalIDOfInterfaceNode = indicesGlobalMatchedOrigin->at(i).at(0).at(j);
716 if( this->
getMapUnique()->getLocalElement(globalIDOfInterfaceNode) != Teuchos::OrdinalTraits<LO>::invalid())
719 vecInterfaceMap.push_back(localInterfaceID);
722 localInterfaceID = localInterfaceID + 1;
728 GO numberInterfaceNodes = localInterfaceID;
731 Teuchos::ArrayView<GO> vecInterfaceMapArray = Teuchos::arrayViewFromVector( vecInterfaceMap );
732 interfaceMapUnique_ = Teuchos::rcp(
new Map_Type( numberInterfaceNodes, vecInterfaceMapArray, 0, comm_ ) );
734 interfaceMapVecFieldUnique_ = interfaceMapUnique_->buildVecFieldMap(dim_);
737template <
class SC,
class LO,
class GO,
class NO>
740 return interfaceMapUnique_;
744template <
class SC,
class LO,
class GO,
class NO>
747 return interfaceMapVecFieldUnique_;
751template <
class SC,
class LO,
class GO,
class NO>
754 return globalInterfaceMapUnique_;
758template <
class SC,
class LO,
class GO,
class NO>
761 return globalInterfaceMapVecFieldUnique_;
764template <
class SC,
class LO,
class GO,
class NO>
767 return otherGlobalInterfaceMapVecFieldUnique_;
770template <
class SC,
class LO,
class GO,
class NO>
773 MeshUnstrPtr_Type meshUnstructured = Teuchos::rcp_dynamic_cast<MeshUnstr_Type>( this->
getMesh() );
774 meshUnstructured->getMeshInterface()->setPartialCoupling(flag, type);
778template <
class SC,
class LO,
class GO,
class NO>
781 MeshUnstrPtr_Type meshUnstructured = Teuchos::rcp_dynamic_cast<MeshUnstr_Type>( this->
getMesh() );
782 MeshInterfacePtr_Type
interface = meshUnstructured->getMeshInterface();
783 vec3D_GO_ptr_Type indicesMatchedUni = interface->getIndicesGlobalMatchedUnique();
785 vec3D_GO_ptr_Type indicesMatchedGlobalSerial = interface->getIndicesGlobalMatchedOrigin();
789 vec_GO_Type vecGlobalInterfaceID(0);
790 vec_GO_Type vecOtherGlobalInterfaceID(0);
791 vec_GO_Type vecInterfaceID(0);
792 vec_int_Type vecInterfaceFlag(0);
795 for(
int i = 0; i < indicesMatchedGlobalSerial->size(); i++)
797 for(
int j = 0; j < indicesMatchedGlobalSerial->at(i).at(0).size(); j++) {
798 LO index = mapUni->getLocalElement( indicesMatchedGlobalSerial->at(i).at(0).at(j) );
799 if ( index != Teuchos::OrdinalTraits<LO>::invalid() ){
800 vecGlobalInterfaceID.push_back( indicesMatchedGlobalSerial->at(i).at(0).at(j) );
801 vecOtherGlobalInterfaceID.push_back( indicesMatchedGlobalSerial->at(i).at(1).at(j) );
802 vecInterfaceID.push_back( (GO) localID );
803 vecInterfaceFlag.push_back( (*flagPointsUni)[index] );
810 Teuchos::ArrayView<GO> vecInterfaceGlobalMapArray = Teuchos::arrayViewFromVector( vecGlobalInterfaceID );
811 Teuchos::ArrayView<GO> vecInterfaceMapArray = Teuchos::arrayViewFromVector( vecInterfaceID );
812 Teuchos::ArrayView<GO> vecOtherInterfaceGlobalMapArray = Teuchos::arrayViewFromVector( vecOtherGlobalInterfaceID );
814 globalInterfaceMapUnique_ = Teuchos::rcp(
new Map_Type( -1, vecInterfaceGlobalMapArray, 0, comm_ ) );
815 interfaceMapUnique_ = Teuchos::rcp(
new Map_Type(-1, vecInterfaceMapArray, 0, comm_ ) );
817 otherGlobalInterfaceMapUnique_ = Teuchos::rcp(
new Map_Type(-1, vecOtherInterfaceGlobalMapArray, 0, comm_ ) );
820 if ( interface->sizePartialCoupling() == 0 ) {
821 globalInterfaceMapVecFieldUnique_ = globalInterfaceMapUnique_->buildVecFieldMap(dim_);
822 interfaceMapVecFieldUnique_ = interfaceMapUnique_->buildVecFieldMap(dim_);
823 otherGlobalInterfaceMapVecFieldUnique_ = otherGlobalInterfaceMapUnique_->buildVecFieldMap(dim_);
827 if (this->comm_->getRank() == 0)
828 std::cout <<
"-- ### Warning! Unique and unique-vector-field map might not be compatiable due to partial coupling conditions. ### --" << std::endl;
831 Teuchos::ArrayView<const GO> elementListGlobal = globalInterfaceMapUnique_->getNodeElementList();
832 Teuchos::ArrayView<const GO> otherElementListGlobal = otherGlobalInterfaceMapUnique_->getNodeElementList();
834 Teuchos::Array<GO> elementListFieldGlobal( 0 );
835 Teuchos::Array<GO> elListFieldPartial( 0 );
837 Teuchos::Array<GO> otherElementListFieldGlobal( 0 );
838 Teuchos::Array<GO> otherElListFieldPartial( 0 );
840 for (UN i=0; i<elementListGlobal.size(); i++) {
841 int loc = interface->isPartialCouplingFlag( vecInterfaceFlag[i] );
843 std::string partialType = interface->getPartialCouplingType( loc );
844 if (partialType ==
"X_Y" && dim_ == 3) {
845 elementListFieldGlobal.push_back (numDofs * elementListGlobal[i] + 0 );
846 elementListFieldGlobal.push_back (numDofs * elementListGlobal[i] + 1 );
847 elementListFieldGlobal.push_back (numDofs * elementListGlobal[i] + 2 );
848 elListFieldPartial.push_back (numDofs * elementListGlobal[i] + 0 );
849 elListFieldPartial.push_back (numDofs * elementListGlobal[i] + 1 );
851 otherElementListFieldGlobal.push_back (numDofs * otherElementListGlobal[i] + 0 );
852 otherElementListFieldGlobal.push_back (numDofs * otherElementListGlobal[i] + 1 );
853 otherElementListFieldGlobal.push_back (numDofs * otherElementListGlobal[i] + 2 );
854 otherElListFieldPartial.push_back (numDofs * otherElementListGlobal[i] + 0 );
855 otherElListFieldPartial.push_back (numDofs * otherElementListGlobal[i] + 1 );
859 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::runtime_error,
"Implement other partial coupling types.");
862 for (UN dof=0; dof<numDofs; dof++){
863 elementListFieldGlobal.push_back( numDofs * elementListGlobal[i] + dof );
864 elListFieldPartial.push_back ( numDofs * elementListGlobal[i] + dof );
865 otherElementListFieldGlobal.push_back( numDofs * otherElementListGlobal[i] + dof );
866 otherElListFieldPartial.push_back ( numDofs * otherElementListGlobal[i] + dof );
870 globalInterfaceMapVecFieldUnique_ = Teuchos::rcp(
new Map_Type( -1, elementListFieldGlobal(), 0, this->
getComm() ) );
871 otherGlobalInterfaceMapVecFieldUnique_ = Teuchos::rcp(
new Map_Type( -1, otherElementListFieldGlobal(), 0, this->
getComm() ) );
873 interfaceMapVecFieldUnique_ = Teuchos::rcp(
new Map_Type(-1, elementListFieldGlobal.size(), 0, this->getComm() ) );
875 partialGlobalInterfaceVecFieldMap_ = Teuchos::rcp(
new Map_Type( -1, elListFieldPartial(), 0, this->
getComm() ) );
876 otherPartialGlobalInterfaceVecFieldMap_ = Teuchos::rcp(
new Map_Type(-1, otherElListFieldPartial(), 0, this->
getComm() ) );
882template <
class SC,
class LO,
class GO,
class NO>
885 nodeID = (GO) (dofID/dim);
886 localDofNumber = (LO) (dofID%dim);
889template <
class SC,
class LO,
class GO,
class NO>
892 dofID = (GO) ( dim * nodeID + localDofNumber);
895template <
class SC,
class LO,
class GO,
class NO>
898 return vecLocalInterfaceIDinGlobal_;
901template <
class SC,
class LO,
class GO,
class NO>
904 MeshUnstrPtr_Type meshUnstructured = Teuchos::rcp(
new MeshUnstr_Type(comm_, 10));
905 mesh_ = meshUnstructured;
907 this->dim_ = domain->getDimension();
908 this->mesh_->mapUnique_ = Teuchos::rcp_const_cast<Map_Type>( domain->getInterfaceMapUnique() );
909 this->mesh_->mapRepeated_ = Teuchos::rcp_const_cast<Map_Type>( domain->getInterfaceMapUnique() );
910 this->mapVecFieldRepeated_ = Teuchos::rcp_const_cast<Map_Type>( domain->getInterfaceMapVecFieldUnique() );
911 this->mapVecFieldUnique_ = Teuchos::rcp_const_cast<Map_Type>( domain->getInterfaceMapVecFieldUnique() );
913 MapConstPtr_Type mapGI = domain->getGlobalInterfaceMapUnique();
914 MapConstPtr_Type mapD = domain->getMapUnique();
915 this->mesh_->pointsRep_.reset(
new std::vector<std::vector<SC> >(mapGI->getNodeNumElements(), std::vector<SC>(this->dim_, 0.0 ) ) );
916 this->mesh_->pointsUni_.reset(
new std::vector<std::vector<SC> >(mapGI->getNodeNumElements(), std::vector<SC>(this->dim_, 0.0 ) ) );
917 vec2D_dbl_ptr_Type pointsUni = domain->getPointsUnique();
918 for (
int i=0; i<mapGI->getNodeNumElements(); i++) {
919 LO index = mapD->getLocalElement( mapGI->getGlobalElement( i ) );
920 for (
int j=0; j<this->dim_; j++){
921 (*this->mesh_->pointsRep_)[i][j] = (*pointsUni)[index][j];
922 (*this->mesh_->pointsUni_)[i][j] = (*pointsUni)[index][j];
932template <
class SC,
class LO,
class GO,
class NO>
935 double eps = 0.0000001;
940 auto iterator = std::find_if( points->begin(), points->end(),
941 [&] (
const std::vector<double>& a){
942 if (a[0] >= x[0]-eps && a[0] <= x[0]+eps
943 && a[1] >= x[1]-eps && a[1] <= x[1]+eps)
949 if ( iterator != points->end() )
950 return std::distance(points->begin(),iterator);
955 auto iterator = std::find_if(points->begin(),points->end(),
956 [&] (
const std::vector<double>& a){
957 if (a[0] >= x[0]-eps && a[0] <= x[0]+eps
958 && a[1] >= x[1]-eps && a[1] <= x[1]+eps
959 && a[2] >= x[2]-eps && a[2] <= x[2]+eps)
965 if ( iterator != points->end() )
966 return std::distance(points->begin(),iterator);
973template <
class SC,
class LO,
class GO,
class NO>
977 MultiVectorPtr_Type nodeList = Teuchos::rcp(
new MultiVector_Type ( map, dim_ ) );
979 for (
int i=0; i<nodeList->getLocalLength(); i++) {
980 for (
int j=0; j<dim_; j++) {
981 Teuchos::ArrayRCP< SC > values = nodeList->getDataNonConst( j );
982 values[i] = (*pointsRepeated)[i][j];
988template <
class SC,
class LO,
class GO,
class NO>
996 Teuchos::ArrayRCP< SC > entries = exportSolution->getDataNonConst(0);
997 for(
int i=0; i< entries.size(); i++){
998 entries[i] = BCFlags->at(i);
1001 Teuchos::RCP<const MultiVector<SC,LO,GO,NO> > exportSolutionConst = exportSolution;
1003 exPara->setup(
"Mesh_Node_Flags_"+name,this->
getMesh(), this->FEType_);
1005 exPara->addVariable(exportSolutionConst,
"Flags",
"Scalar", 1,this->
getMapUnique());
1008 exPara->closeExporter();
1011template <
class SC,
class LO,
class GO,
class NO>
1017 exportSolution->putScalar(comm_->getRank()+1.);
1019 Teuchos::RCP<const MultiVector<SC,LO,GO,NO> > exportSolutionConst = exportSolution;
1021 exPara->setup(
"Subdomains"+name,this->
getMesh(),
"P0");
1023 exPara->addVariable(exportSolutionConst,
"Core",
"Scalar", 1,this->
getElementMap());
1026 exPara->closeExporter();
1030template <
class SC,
class LO,
class GO,
class NO>
1036 exportSolution->putScalar(0.);
1039 Teuchos::ArrayRCP< SC > entries = exportSolution->getDataNonConst(0);
1042 for (UN T=0; T<elementsC->numberElements(); T++) {
1044 ElementsPtr_Type subEl = fe.getSubElements();
1045 for (
int surface=0; surface<fe.numSubElements(); surface++) {
1047 vec_int_Type nodeListElement = fe.getVectorNodeList();
1048 if(subEl->getDimension() == dim_-1 ){
1049 vec_int_Type nodeList = feSub.getVectorNodeListNonConst();
1051 vec_dbl_Type v_E(dim_,1.);
1056 for(
int j=0; j< nodeList.size(); j++){
1057 for(
int i=0; i< this->dim_; i++){
1060 entries[
id*this->dim_+i] = 1./norm_v_E * v_E[i];
1068 Teuchos::RCP<const MultiVector<SC,LO,GO,NO> > exportSolutionConst = exportSolution;
1070 exPara->setup(
"Mesh_Surface_Directions_"+name,this->
getMesh(), this->FEType_);
1072 exPara->addVariable(exportSolutionConst,
"SurfaceNormals",
"Vector", this->dim_,this->
getMapUnique());
1075 exPara->closeExporter();
1078template <
class SC,
class LO,
class GO,
class NO>
1084 exportSolution->putScalar(0.);
1087 Teuchos::ArrayRCP< SC > entries = exportSolution->getDataNonConst(0);
1093 for (UN T=0; T<elementsC->numberElements(); T++) {
1095 detB = B.computeInverse(Binv);
1099 Teuchos::RCP<const MultiVector<SC,LO,GO,NO> > exportSolutionConst = exportSolution;
1101 exPara->setup(
"Mesh_Element_Orientation_"+name,this->
getMesh(),
"P0");
1103 exPara->addVariable(exportSolutionConst,
"VolElement",
"Scalar", 1,this->
getElementMap());
1106 exPara->closeExporter();
1110template <
class SC,
class LO,
class GO,
class NO>
1117 Teuchos::ArrayRCP< SC > entries = exportSolution->getDataNonConst(0);
1120 for(
int i=0; i< entries.size(); i++){
1121 entries[i] = elements->getElement(i).getFlag();
1124 Teuchos::RCP<const MultiVector<SC,LO,GO,NO> > exportSolutionConst = exportSolution;
1126 exPara->setup(
"Mesh_Element_Flags_"+name,this->
getMesh(),
"P0");
1128 exPara->addVariable(exportSolutionConst,
"Flags",
"Scalar", 1,this->
getElementMap());
1132 exPara->closeExporter();
vec_int_ptr_Type getElementsFlag() const
Returns flags of elements as vector of type int.
Definition Domain_def.hpp:170
UN getDimension() const
Get dimension.
Definition Domain_def.hpp:422
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:387
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:1031
MapConstPtr_Type getMapRepeated() const
void preProcessMesh(bool correctSurfaceNormals, bool correctElementDirection)
Option of preprocessing mesh by making consistent outward normal and/or consistent element orientatio...
Definition Domain_def.hpp:409
CommConstPtr_Type getComm() const
Communicator.
Definition Domain_def.hpp:434
vec_int_ptr_Type getBCFlagUnique() const
Get vector of the flags corrsponding to the unique points (on your processor)
Definition Domain_def.hpp:481
MapConstPtr_Type getMapVecFieldRepeated() const
Definition Domain_def.hpp:509
void exportDistribution(std::string name="default")
Exporting Paraview file displaying distribution of elements to the differnt cores.
Definition Domain_def.hpp:1012
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:203
vec2D_int_ptr_Type getElements() const
Get the elements (on your processor) as vector data type.
Definition Domain_def.hpp:487
void setPartialCoupling(int flag, std::string type)
Set partial coupling.
Definition Domain_def.hpp:771
MeshPtr_Type getMesh()
Get mesh.
Definition Domain_def.hpp:668
void buildInterfaceMaps()
Build interface maps.
Definition Domain_def.hpp:779
void identifyInterfaceParallelAndDistance(DomainPtr_Type domainOther, vec_int_Type interfaceID_vec)
Itentify interface parallal and distance.
Definition Domain_def.hpp:564
void toDofID(UN dim, GO nodeID, LO localDofNumber, GO &dofID)
Hilfsfunktion fuer buildLocalInterfaceIDInGlobal(). Gibt fuer eine gegebene nodeID die entsprechende ...
Definition Domain_def.hpp:890
vec_long_Type getLocalInterfaceIDInGlobal() const
Get local interface id in global.
Definition Domain_def.hpp:896
void readMeshSize(std::string filename, std::string delimiter)
Reading mesh size.
Definition Domain_def.hpp:282
void buildUniqueInterfaceMaps()
Build unique node and dof interfaceMap in interface numbering.
Definition Domain_def.hpp:686
void partitionMesh(bool partitionDistance=false)
Partition mesh according to number of processors. Partition with parmetis.
Definition Domain_def.hpp:293
MapConstPtr_Type getMapUnique() const
MultiVectorPtr_Type getNodeListMV() const
Get node list in multi vector point.
Definition Domain_def.hpp:974
void initializeUnstructuredMesh(int dimension, std::string feType, int volumeID=10, std::string meshUnit="cm", bool convertToCM=false)
Generally the domain object holds only meshes from type 'Mesh'. If we read a mesh from file it become...
Definition Domain_def.hpp:268
MapConstPtr_Type getOtherGlobalInterfaceMapVecFieldUnique() const
Get other interface vec field map unique (for fsi coupling block c4)
Definition Domain_def.hpp:765
LO getNumElements() const
Get local number of elements (on your processor)
Definition Domain_def.hpp:524
void setMesh(MeshUnstrPtr_Type meshUnstr)
Settng mesh from domain.
Definition Domain_def.hpp:380
ElementsPtr_Type getElementsC() const
Get the elements (on your processor) as Elements_Type.
Definition Domain_def.hpp:493
void toNodeID(UN dim, GO dofID, GO &nodeID, LO &localDofNumber)
Hilfsfunktion fuer buildLocalInterfaceIDInGlobal(). Gibt fuer eine gegebene nodeID die entsprechende ...
Definition Domain_def.hpp:883
int findInPointsUnique(const vec_dbl_Type &x) const
Find in points unique.
Definition Domain_def.hpp:933
int checkGeomentry(std::string MeshType, int dim) const
Domain()
Constructor.
Definition Domain_def.hpp:15
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:463
void initializeFEData()
initializeFEData
Definition Domain_def.hpp:164
void moveMesh(MultiVectorPtr_Type displacementUnique, MultiVectorPtr_Type displacementRepeated)
Move mesh according to displacement (i.e. used in FSI)
Definition Domain_def.hpp:679
std::string getFEType() const
Finite element discretization. Represented as string, i.e., P2.
Definition Domain_def.hpp:428
LO getNumPoints(std::string type="Unique") const
Get local number of points of type 'type' (unique/repeated)
Definition Domain_def.hpp:530
MapConstPtr_Type getEdgeMap() const
Get map of edges.
Definition Domain_def.hpp:457
GO getNumElementsGlobal() const
Get global number of elements.
Definition Domain_def.hpp:518
void initWithDomain(DomainPtr_Type domainsP1)
Initialize domain with already existing domain.
Definition Domain_def.hpp:354
void exportElementFlags(std::string name="default")
Exporting Paraview file displaying element flags of the underlying mesh.
Definition Domain_def.hpp:1111
MapConstPtr_Type getGlobalInterfaceMapUnique() const
Get interface map unique (for fsi coupling block c4)
Definition Domain_def.hpp:752
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:335
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:469
void exportNodeFlags(std::string name="default")
Exporting Paraview file displaying node flags of the underlying mesh.
Definition Domain_def.hpp:989
MapConstPtr_Type getInterfaceMapVecFieldUnique() const
Get interface vector field map unique.
Definition Domain_def.hpp:745
void exportElementOrientation(std::string name="default")
Exporting Paraview file displaying element volume of underlying mesh.
Definition Domain_def.hpp:1079
void info() const
Information about the domain.
Definition Domain_def.hpp:140
MapConstPtr_Type getElementMap() const
Get map of elements.
Definition Domain_def.hpp:451
vec_int_ptr_Type getBCFlagRepeated() const
Get vector of the flags corrsponding to the repeated points (on your processor)
Definition Domain_def.hpp:475
void setReferenceConfiguration()
Set reference configuration.
Definition Domain_def.hpp:662
MapConstPtr_Type getGlobalInterfaceMapVecFieldUnique() const
Get interface vec field map unique (for fsi coupling block c4)
Definition Domain_def.hpp:759
LO getApproxEntriesPerRow() const
Estimate depending on FEType and dimension for the numer of entries in system matrix,...
Definition Domain_def.hpp:176
vec_dbl_ptr_Type getDistancesToInterface() const
Get distances to interface.
Definition Domain_def.hpp:657
void exportMesh(bool exportEdges=false, bool exportSurfaces=false, std::string exportMesh="export.mesh")
Exporting Mesh.
Definition Domain_def.hpp:401
MapConstPtr_Type getInterfaceMapUnique() const
Get interface map unique.
Definition Domain_def.hpp:738
void setDummyInterfaceDomain(DomainPtr_Type domain)
Set dummy interface domain.
Definition Domain_def.hpp:902
void calculateDistancesToInterface()
Calculate distance to interface.
Definition Domain_def.hpp:574
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:318
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:500
Definition ExporterParaView_decl.hpp:30
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:61
This class represents a templated small Matrix of type T. Primarily created for 2x2 and 3x3 matrices....
Definition SmallMatrix.hpp:20
Adaptive Mesh Refinement.
Definition AdaptiveMeshRefinement_decl.hpp:36