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");
106 geometries2DVec_->push_back(
"SquareTPM");
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 meshStructured->setGeometry2DRectangle(coorRec, length, height);
234 meshStructured->buildMesh2DTPM(FEType, n_, m_, numProcsCoarseSolve);
237 meshStructured->setGeometry2DRectangle(coorRec, length, height);
238 meshStructured->buildMesh2DMiniTPM(FEType, n_, m_, numProcsCoarseSolve);
241 TEUCHOS_TEST_FOR_EXCEPTION(
true,std::logic_error,
"Select valid mesh. Structured types are 'structured' and 'structured_bfs' in 2D. TPM test meshes also available.");
249 meshStructured->setGeometry3DBox(coorRec, length, width, height);
250 meshStructured->buildMesh3D( FEType, n_, m_, numProcsCoarseSolve);
253 meshStructured->setGeometry3DBox(coorRec, length, width, height);
254 meshStructured->buildMesh3DBFS( FEType, n_, m_, numProcsCoarseSolve);
257 meshStructured->setGeometry3DBox(coorRec, length, width, height);
258 meshStructured->buildMesh3D5Elements( FEType, n_, m_, numProcsCoarseSolve);
261 TEUCHOS_TEST_FOR_EXCEPTION(
true,std::runtime_error,
"Select valid mesh. Structured types are 'structured' and 'structured_bfs' in 3D." );
266 TEUCHOS_TEST_FOR_EXCEPTION(
true,std::logic_error,
"Select valid mesh dimension. 2 or 3 dimensional meshes can be constructed.");
269 meshStructured->buildElementMap();
270 meshStructured->setStructuredMeshFlags(flagsOption,FEType);
271 meshStructured->buildSurfaces(flagsOption,FEType);
273 mesh_ = meshStructured;
276template <
class SC,
class LO,
class GO,
class NO>
279 MeshUnstrPtr_Type meshUnstructured = Teuchos::rcp(
new MeshUnstr_Type(comm_, volumeID));
280 mesh_ = meshUnstructured;
281 mesh_->dim_ = dimension;
283 meshType_ =
"unstructured";
284 numProcsCoarseSolve_ = 0;
285 n_ = comm_->getSize() - numProcsCoarseSolve_;
290template <
class SC,
class LO,
class GO,
class NO>
293 MeshUnstrPtr_Type meshUnstructured = Teuchos::rcp_dynamic_cast<MeshUnstr_Type>( mesh_ );
294 TEUCHOS_TEST_FOR_EXCEPTION( meshUnstructured.is_null(), std::runtime_error,
"Unstructured Mesh is null." );
296 meshUnstructured->setMeshFileName( filename, delimiter );
297 meshUnstructured->readMeshSize( );
301template <
class SC,
class LO,
class GO,
class NO>
304 MeshUnstrPtr_Type meshUnstructured = Teuchos::rcp_dynamic_cast<MeshUnstr_Type>( mesh_ );
306 if (partitionDistance)
309 mesh_ = meshUnstructured;
313template <
class SC,
class LO,
class GO,
class NO>
316 vec_dbl_Type tmp = *distancesToInterface_;
318 distancesToInterface_.reset(
new vec_dbl_Type ( mesh_->getMapRepeated()->getNodeNumElements() ) );
320 for (UN i=0; i<distancesToInterface_->size(); i++) {
321 GO index = mesh_->getMapRepeated()->getGlobalElement(i);
322 distancesToInterface_->at(i) = tmp[index];
326template <
class SC,
class LO,
class GO,
class NO>
329 MeshUnstrPtr_Type meshUnstructured = Teuchos::rcp(
new MeshUnstr_Type(comm_, volumeID));
334 mesh_ = meshUnstructured;
336 numProcsCoarseSolve_ = 0;
337 n_ = comm_->getSize() - numProcsCoarseSolve_;
340 meshType_ =
"unstructured";
343template <
class SC,
class LO,
class GO,
class NO>
346 MeshUnstrPtr_Type meshUnstructuredP1 = Teuchos::rcp_dynamic_cast<MeshUnstr_Type>( domainP1->mesh_ );
348 MeshUnstrPtr_Type meshUnstructured = Teuchos::rcp(
new MeshUnstr_Type( comm_, meshUnstructuredP1->volumeID_) );
352 dim_ = domainP1->dim_;
354 numProcsCoarseSolve_ = 0;
356 meshType_ =
"unstructured";
358 meshUnstructured->buildP2ofP1MeshEdge( meshUnstructuredP1 );
359 mesh_ = meshUnstructured;
362template <
class SC,
class LO,
class GO,
class NO>
367 dim_ = domainP1->dim_;
368 FEType_ = domainP1->FEType_;
370 numProcsCoarseSolve_ = 0;
373 meshType_ = domainP1->meshType_;
375 mesh_ = domainP1->mesh_;
388template <
class SC,
class LO,
class GO,
class NO>
395template <
class SC,
class LO,
class GO,
class NO>
398 MeshUnstrPtr_Type outputMesh = Teuchos::rcp(
new MeshUnstr_Type( comm_) );
400 outputMesh->dim_ = this->dim_ ;
401 outputMesh->FEType_ = this->FEType_ ;
403 outputMesh->mapUnique_ = map;
404 outputMesh->mapRepeated_ = map;
409template <
class SC,
class LO,
class GO,
class NO>
412 MeshUnstrPtr_Type meshUnstructured = Teuchos::rcp_dynamic_cast<MeshUnstr_Type>( mesh_ );
417template <
class SC,
class LO,
class GO,
class NO>
420 if(correctSurfaceNormals)
421 mesh_->correctNormalDirections();
423 if(correctElementOrientation)
424 mesh_->correctElementOrientation();
430template <
class SC,
class LO,
class GO,
class NO>
436template <
class SC,
class LO,
class GO,
class NO>
442template <
class SC,
class LO,
class GO,
class NO>
447template <
class SC,
class LO,
class GO,
class NO>
450 return mesh_->getMapUnique();
453template <
class SC,
class LO,
class GO,
class NO>
456 return mesh_->getMapRepeated();
459template <
class SC,
class LO,
class GO,
class NO>
462 return mesh_->getElementMap();
465template <
class SC,
class LO,
class GO,
class NO>
468 return mesh_->getEdgeMap();
471template <
class SC,
class LO,
class GO,
class NO>
474 return mesh_->getPointsRepeated();
477template <
class SC,
class LO,
class GO,
class NO>
480 return mesh_->getPointsUnique();
483template <
class SC,
class LO,
class GO,
class NO>
486 return mesh_->getBCFlagRepeated();
489template <
class SC,
class LO,
class GO,
class NO>
492 return mesh_->getBCFlagUnique();
495template <
class SC,
class LO,
class GO,
class NO>
497 TEUCHOS_TEST_FOR_EXCEPTION(mesh_->getElementsC().is_null(), std::runtime_error,
"Elements is null for this mesh.");
498 return mesh_->getElements();
501template <
class SC,
class LO,
class GO,
class NO>
503 TEUCHOS_TEST_FOR_EXCEPTION(mesh_->getElementsC().is_null(), std::runtime_error,
"Elements is null for this mesh.");
504 return mesh_->getElementsC();
508template <
class SC,
class LO,
class GO,
class NO>
510 if ( mapVecFieldUnique_.is_null() ) {
512 mapVecFieldUnique_ = mapTmp->buildVecFieldMap(dim_);
514 return mapVecFieldUnique_;
517template <
class SC,
class LO,
class GO,
class NO>
519 if ( mapVecFieldRepeated_.is_null() ) {
521 mapVecFieldRepeated_ = mapTmp->buildVecFieldMap(dim_);
523 return mapVecFieldRepeated_;
526template <
class SC,
class LO,
class GO,
class NO>
529 return mesh_->getNumElementsGlobal();
532template <
class SC,
class LO,
class GO,
class NO>
535 return mesh_->getNumElements();
538template <
class SC,
class LO,
class GO,
class NO>
541 return mesh_->getNumPoints(type);
544template <
class SC,
class LO,
class GO,
class NO>
550 for (
int i = 0; i<geometries2DVec_->size(); i++) {
551 notfoundLabel = meshType.compare(geometries2DVec_->at(i));
552 if (notfoundLabel==0) {
558 for (
int i = 0; i<geometries3DVec_->size(); i++) {
559 notfoundLabel = meshType.compare(geometries3DVec_->at(i));
560 if (notfoundLabel==0) {
566 TEUCHOS_TEST_FOR_EXCEPTION(
true,std::logic_error,
"Select valid geometry.");
572template <
class SC,
class LO,
class GO,
class NO>
575 MeshUnstrPtr_Type meshUnstructured = Teuchos::rcp_dynamic_cast<MeshUnstr_Type>( mesh_ );
576 MeshUnstrPtr_Type meshUnstructuredOther = Teuchos::rcp_dynamic_cast<MeshUnstr_Type>( domainOther->mesh_ );
577 meshUnstructured->buildMeshInterfaceParallelAndDistance( meshUnstructuredOther, interfaceID_vec, distancesToInterface_ );
582template <
class SC,
class LO,
class GO,
class NO>
587 MeshUnstrPtr_Type meshUnstructured = Teuchos::rcp_dynamic_cast<MeshUnstr_Type>( mesh_ );
596 vec3D_GO_ptr_Type indicesGlobalMatched = meshUnstructured->meshInterface_->getIndicesGlobalMatched();
602 vec2D_dbl_ptr_Type sourceNodesRep = meshUnstructured->getPointsRepeated();
605 int numberInterfaceNodes = 0;
606 for(
int i = 0; i < indicesGlobalMatched->size(); i++)
608 for(
int j = 0; j < indicesGlobalMatched->at(i).at(0).size(); j++)
610 numberInterfaceNodes = numberInterfaceNodes + 1;
615 vec2D_dbl_ptr_Type endNodesRep(
new vec2D_dbl_Type( numberInterfaceNodes, vec_dbl_Type( dim_, 0.0 ) ) );
617 int globalIDOfInterfaceNode;
618 for(
int i = 0; i < indicesGlobalMatched->size(); i++)
620 for(
int j = 0; j < indicesGlobalMatched->at(i).at(0).size(); j++)
623 globalIDOfInterfaceNode = indicesGlobalMatched->at(i).at(0).at(j);
625 for(
int k = 0; k < dim_; k++)
627 endNodesRep->at(counter).at(k) = meshUnstructured->getPointsRepeated()->at( globalIDOfInterfaceNode ).at( k );
630 counter = counter + 1;
636 vec_dbl_ptr_Type tempVec(
new vec_dbl_Type( meshUnstructured->getPointsRepeated()->size(), 1000.0 ) );
637 distancesToInterface_ = tempVec;
640 double distance = 0.0;
641 for(
int i = 0; i < sourceNodesRep->size(); i++)
643 for(
int j = 0; j < endNodesRep->size(); j++)
645 for(
int k = 0; k < dim_; k++)
647 distance = distance + std::pow( sourceNodesRep->at(i).at(k) - endNodesRep->at(j).at(k), 2.0 );
651 distance = std::sqrt(distance);
653 if(distancesToInterface_->at(i) > distance)
655 distancesToInterface_->at(i) = distance;
665template <
class SC,
class LO,
class GO,
class NO>
667 return distancesToInterface_;
670template <
class SC,
class LO,
class GO,
class NO>
673 mesh_->setReferenceConfiguration();
676template <
class SC,
class LO,
class GO,
class NO>
681template <
class SC,
class LO,
class GO,
class NO>
683 MeshConstPtr_Type meshConst = mesh_;
687template <
class SC,
class LO,
class GO,
class NO>
690 mesh_->moveMesh(displacementUnique, displacementRepeated);
694template <
class SC,
class LO,
class GO,
class NO>
700 MeshUnstrPtr_Type meshUnstructured = Teuchos::rcp_dynamic_cast<MeshUnstr_Type>( this->
getMesh() );
702 vec3D_GO_ptr_Type indicesGlobalMatchedOrigin = meshUnstructured->getMeshInterface()->getIndicesGlobalMatchedOrigin();
705 GO localInterfaceID = 0;
709 vec_GO_Type vecInterfaceMap;
718 for(
int i = 0; i < indicesGlobalMatchedOrigin->size(); i++)
720 for(
int j = 0; j < indicesGlobalMatchedOrigin->at(i).at(0).size(); j++)
723 GO globalIDOfInterfaceNode = indicesGlobalMatchedOrigin->at(i).at(0).at(j);
725 if( this->
getMapUnique()->getLocalElement(globalIDOfInterfaceNode) != Teuchos::OrdinalTraits<LO>::invalid())
728 vecInterfaceMap.push_back(localInterfaceID);
731 localInterfaceID = localInterfaceID + 1;
737 GO numberInterfaceNodes = localInterfaceID;
741 Teuchos::ArrayView<GO> vecInterfaceMapArray = Teuchos::arrayViewFromVector( vecInterfaceMap );
742 interfaceMapUnique_ = Teuchos::rcp(
new Map_Type( numberInterfaceNodes, vecInterfaceMapArray, 0, comm_ ) );
744 interfaceMapVecFieldUnique_ = interfaceMapUnique_->buildVecFieldMap(dim_);
747template <
class SC,
class LO,
class GO,
class NO>
750 return interfaceMapUnique_;
754template <
class SC,
class LO,
class GO,
class NO>
757 return interfaceMapVecFieldUnique_;
761template <
class SC,
class LO,
class GO,
class NO>
764 return globalInterfaceMapUnique_;
768template <
class SC,
class LO,
class GO,
class NO>
771 return globalInterfaceMapVecFieldUnique_;
774template <
class SC,
class LO,
class GO,
class NO>
777 return otherGlobalInterfaceMapVecFieldUnique_;
780template <
class SC,
class LO,
class GO,
class NO>
783 MeshUnstrPtr_Type meshUnstructured = Teuchos::rcp_dynamic_cast<MeshUnstr_Type>( this->
getMesh() );
784 meshUnstructured->getMeshInterface()->setPartialCoupling(flag, type);
788template <
class SC,
class LO,
class GO,
class NO>
791 MeshUnstrPtr_Type meshUnstructured = Teuchos::rcp_dynamic_cast<MeshUnstr_Type>( this->
getMesh() );
792 MeshInterfacePtr_Type
interface = meshUnstructured->getMeshInterface();
793 vec3D_GO_ptr_Type indicesMatchedUni = interface->getIndicesGlobalMatchedUnique();
795 vec3D_GO_ptr_Type indicesMatchedGlobalSerial = interface->getIndicesGlobalMatchedOrigin();
799 vec_GO_Type vecGlobalInterfaceID(0);
800 vec_GO_Type vecOtherGlobalInterfaceID(0);
801 vec_GO_Type vecInterfaceID(0);
802 vec_int_Type vecInterfaceFlag(0);
805 for(
int i = 0; i < indicesMatchedGlobalSerial->size(); i++)
807 for(
int j = 0; j < indicesMatchedGlobalSerial->at(i).at(0).size(); j++) {
808 LO index = mapUni->getLocalElement( indicesMatchedGlobalSerial->at(i).at(0).at(j) );
809 if ( index != Teuchos::OrdinalTraits<LO>::invalid() ){
810 vecGlobalInterfaceID.push_back( indicesMatchedGlobalSerial->at(i).at(0).at(j) );
811 vecOtherGlobalInterfaceID.push_back( indicesMatchedGlobalSerial->at(i).at(1).at(j) );
812 vecInterfaceID.push_back( (GO) localID );
813 vecInterfaceFlag.push_back( (*flagPointsUni)[index] );
820 Teuchos::ArrayView<GO> vecInterfaceGlobalMapArray = Teuchos::arrayViewFromVector( vecGlobalInterfaceID );
821 Teuchos::ArrayView<GO> vecInterfaceMapArray = Teuchos::arrayViewFromVector( vecInterfaceID );
822 Teuchos::ArrayView<GO> vecOtherInterfaceGlobalMapArray = Teuchos::arrayViewFromVector( vecOtherGlobalInterfaceID );
824 globalInterfaceMapUnique_ = Teuchos::rcp(
new Map_Type( -1, vecInterfaceGlobalMapArray, 0, comm_ ) );
825 interfaceMapUnique_ = Teuchos::rcp(
new Map_Type(-1, vecInterfaceMapArray, 0, comm_ ) );
827 otherGlobalInterfaceMapUnique_ = Teuchos::rcp(
new Map_Type(-1, vecOtherInterfaceGlobalMapArray, 0, comm_ ) );
830 if ( interface->sizePartialCoupling() == 0 ) {
831 globalInterfaceMapVecFieldUnique_ = globalInterfaceMapUnique_->buildVecFieldMap(dim_);
832 interfaceMapVecFieldUnique_ = interfaceMapUnique_->buildVecFieldMap(dim_);
833 otherGlobalInterfaceMapVecFieldUnique_ = otherGlobalInterfaceMapUnique_->buildVecFieldMap(dim_);
837 if (this->comm_->getRank() == 0)
838 std::cout <<
"-- ### Warning! Unique and unique-vector-field map might not be compatiable due to partial coupling conditions. ### --" << std::endl;
841 Teuchos::ArrayView<const GO> elementListGlobal = globalInterfaceMapUnique_->getNodeElementList();
842 Teuchos::ArrayView<const GO> otherElementListGlobal = otherGlobalInterfaceMapUnique_->getNodeElementList();
844 Teuchos::Array<GO> elementListFieldGlobal( 0 );
845 Teuchos::Array<GO> elListFieldPartial( 0 );
847 Teuchos::Array<GO> otherElementListFieldGlobal( 0 );
848 Teuchos::Array<GO> otherElListFieldPartial( 0 );
850 for (UN i=0; i<elementListGlobal.size(); i++) {
851 int loc = interface->isPartialCouplingFlag( vecInterfaceFlag[i] );
853 std::string partialType = interface->getPartialCouplingType( loc );
854 if (partialType ==
"X_Y" && dim_ == 3) {
855 elementListFieldGlobal.push_back (numDofs * elementListGlobal[i] + 0 );
856 elementListFieldGlobal.push_back (numDofs * elementListGlobal[i] + 1 );
857 elementListFieldGlobal.push_back (numDofs * elementListGlobal[i] + 2 );
858 elListFieldPartial.push_back (numDofs * elementListGlobal[i] + 0 );
859 elListFieldPartial.push_back (numDofs * elementListGlobal[i] + 1 );
861 otherElementListFieldGlobal.push_back (numDofs * otherElementListGlobal[i] + 0 );
862 otherElementListFieldGlobal.push_back (numDofs * otherElementListGlobal[i] + 1 );
863 otherElementListFieldGlobal.push_back (numDofs * otherElementListGlobal[i] + 2 );
864 otherElListFieldPartial.push_back (numDofs * otherElementListGlobal[i] + 0 );
865 otherElListFieldPartial.push_back (numDofs * otherElementListGlobal[i] + 1 );
869 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::runtime_error,
"Implement other partial coupling types.");
872 for (UN dof=0; dof<numDofs; dof++){
873 elementListFieldGlobal.push_back( numDofs * elementListGlobal[i] + dof );
874 elListFieldPartial.push_back ( numDofs * elementListGlobal[i] + dof );
875 otherElementListFieldGlobal.push_back( numDofs * otherElementListGlobal[i] + dof );
876 otherElListFieldPartial.push_back ( numDofs * otherElementListGlobal[i] + dof );
880 globalInterfaceMapVecFieldUnique_ = Teuchos::rcp(
new Map_Type( -1, elementListFieldGlobal(), 0, this->
getComm() ) );
881 otherGlobalInterfaceMapVecFieldUnique_ = Teuchos::rcp(
new Map_Type( -1, otherElementListFieldGlobal(), 0, this->
getComm() ) );
883 interfaceMapVecFieldUnique_ = Teuchos::rcp(
new Map_Type(-1, elementListFieldGlobal.size(), 0, this->getComm() ) );
885 partialGlobalInterfaceVecFieldMap_ = Teuchos::rcp(
new Map_Type( -1, elListFieldPartial(), 0, this->
getComm() ) );
886 otherPartialGlobalInterfaceVecFieldMap_ = Teuchos::rcp(
new Map_Type(-1, otherElListFieldPartial(), 0, this->
getComm() ) );
892template <
class SC,
class LO,
class GO,
class NO>
895 nodeID = (GO) (dofID/dim);
896 localDofNumber = (LO) (dofID%dim);
899template <
class SC,
class LO,
class GO,
class NO>
902 dofID = (GO) ( dim * nodeID + localDofNumber);
905template <
class SC,
class LO,
class GO,
class NO>
908 return vecLocalInterfaceIDinGlobal_;
911template <
class SC,
class LO,
class GO,
class NO>
914 MeshUnstrPtr_Type meshUnstructured = Teuchos::rcp(
new MeshUnstr_Type(comm_, 10));
915 mesh_ = meshUnstructured;
917 this->dim_ = domain->getDimension();
918 this->mesh_->mapUnique_ = Teuchos::rcp_const_cast<Map_Type>( domain->getInterfaceMapUnique() );
919 this->mesh_->mapRepeated_ = Teuchos::rcp_const_cast<Map_Type>( domain->getInterfaceMapUnique() );
920 this->mapVecFieldRepeated_ = Teuchos::rcp_const_cast<Map_Type>( domain->getInterfaceMapVecFieldUnique() );
921 this->mapVecFieldUnique_ = Teuchos::rcp_const_cast<Map_Type>( domain->getInterfaceMapVecFieldUnique() );
923 MapConstPtr_Type mapGI = domain->getGlobalInterfaceMapUnique();
924 MapConstPtr_Type mapD = domain->getMapUnique();
925 this->mesh_->pointsRep_.reset(
new std::vector<std::vector<SC> >(mapGI->getNodeNumElements(), std::vector<SC>(this->dim_, 0.0 ) ) );
926 this->mesh_->pointsUni_.reset(
new std::vector<std::vector<SC> >(mapGI->getNodeNumElements(), std::vector<SC>(this->dim_, 0.0 ) ) );
927 vec2D_dbl_ptr_Type pointsUni = domain->getPointsUnique();
928 for (
int i=0; i<mapGI->getNodeNumElements(); i++) {
929 LO index = mapD->getLocalElement( mapGI->getGlobalElement( i ) );
930 for (
int j=0; j<this->dim_; j++){
931 (*this->mesh_->pointsRep_)[i][j] = (*pointsUni)[index][j];
932 (*this->mesh_->pointsUni_)[i][j] = (*pointsUni)[index][j];
942template <
class SC,
class LO,
class GO,
class NO>
945 double eps = 0.0000001;
950 auto iterator = std::find_if( points->begin(), points->end(),
951 [&] (
const std::vector<double>& a){
952 if (a[0] >= x[0]-eps && a[0] <= x[0]+eps
953 && a[1] >= x[1]-eps && a[1] <= x[1]+eps)
959 if ( iterator != points->end() )
960 return std::distance(points->begin(),iterator);
965 auto iterator = std::find_if(points->begin(),points->end(),
966 [&] (
const std::vector<double>& a){
967 if (a[0] >= x[0]-eps && a[0] <= x[0]+eps
968 && a[1] >= x[1]-eps && a[1] <= x[1]+eps
969 && a[2] >= x[2]-eps && a[2] <= x[2]+eps)
975 if ( iterator != points->end() )
976 return std::distance(points->begin(),iterator);
983template <
class SC,
class LO,
class GO,
class NO>
987 MultiVectorPtr_Type nodeList = Teuchos::rcp(
new MultiVector_Type ( map, dim_ ) );
989 for (
int i=0; i<nodeList->getLocalLength(); i++) {
990 for (
int j=0; j<dim_; j++) {
991 Teuchos::ArrayRCP< SC > values = nodeList->getDataNonConst( j );
992 values[i] = (*pointsRepeated)[i][j];
998template <
class SC,
class LO,
class GO,
class NO>
1006 Teuchos::ArrayRCP< SC > entries = exportSolution->getDataNonConst(0);
1007 for(
int i=0; i< entries.size(); i++){
1008 entries[i] = BCFlags->at(i);
1011 Teuchos::RCP<const MultiVector<SC,LO,GO,NO> > exportSolutionConst = exportSolution;
1013 exPara->setup(
"Mesh_Node_Flags_"+name,this->
getMesh(), this->FEType_);
1015 exPara->addVariable(exportSolutionConst,
"Flags",
"Scalar", 1,this->
getMapUnique());
1018 exPara->closeExporter();
1021template <
class SC,
class LO,
class GO,
class NO>
1027 exportSolution->putScalar(0.);
1030 Teuchos::ArrayRCP< SC > entries = exportSolution->getDataNonConst(0);
1033 for (UN T=0; T<elementsC->numberElements(); T++) {
1035 ElementsPtr_Type subEl = fe.getSubElements();
1036 for (
int surface=0; surface<fe.numSubElements(); surface++) {
1038 vec_int_Type nodeListElement = fe.getVectorNodeList();
1039 if(subEl->getDimension() == dim_-1 ){
1040 vec_int_Type nodeList = feSub.getVectorNodeListNonConst();
1042 vec_dbl_Type v_E(dim_,1.);
1047 for(
int j=0; j< nodeList.size(); j++){
1048 for(
int i=0; i< this->dim_; i++){
1051 entries[
id*this->dim_+i] = 1./norm_v_E * v_E[i];
1059 Teuchos::RCP<const MultiVector<SC,LO,GO,NO> > exportSolutionConst = exportSolution;
1061 exPara->setup(
"Mesh_Surface_Directions_"+name,this->
getMesh(), this->FEType_);
1063 exPara->addVariable(exportSolutionConst,
"SurfaceNormals",
"Vector", this->dim_,this->
getMapUnique());
1066 exPara->closeExporter();
1069template <
class SC,
class LO,
class GO,
class NO>
1075 exportSolution->putScalar(0.);
1078 Teuchos::ArrayRCP< SC > entries = exportSolution->getDataNonConst(0);
1084 for (UN T=0; T<elementsC->numberElements(); T++) {
1086 detB = B.computeInverse(Binv);
1090 Teuchos::RCP<const MultiVector<SC,LO,GO,NO> > exportSolutionConst = exportSolution;
1092 exPara->setup(
"Mesh_Element_Orientation_"+name,this->
getMesh(),
"P0");
1094 exPara->addVariable(exportSolutionConst,
"VolElement",
"Scalar", 1,this->
getElementMap());
1097 exPara->closeExporter();
1101template <
class SC,
class LO,
class GO,
class NO>
1108 Teuchos::ArrayRCP< SC > entries = exportSolution->getDataNonConst(0);
1111 for(
int i=0; i< entries.size(); i++){
1112 entries[i] = elements->getElement(i).getFlag();
1115 Teuchos::RCP<const MultiVector<SC,LO,GO,NO> > exportSolutionConst = exportSolution;
1117 exPara->setup(
"Mesh_Element_Flags_"+name,this->
getMesh(),
"P0");
1119 exPara->addVariable(exportSolutionConst,
"Flags",
"Scalar", 1,this->
getElementMap());
1123 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:431
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:396
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:1022
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:418
CommConstPtr_Type getComm() const
Communicator.
Definition Domain_def.hpp:443
vec_int_ptr_Type getBCFlagUnique() const
Get vector of the flags corrsponding to the unique points (on your processor)
Definition Domain_def.hpp:490
MapConstPtr_Type getMapVecFieldRepeated() const
Definition Domain_def.hpp:518
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:496
void setPartialCoupling(int flag, std::string type)
Set partial coupling.
Definition Domain_def.hpp:781
MeshPtr_Type getMesh()
Get mesh.
Definition Domain_def.hpp:677
void buildInterfaceMaps()
Build interface maps.
Definition Domain_def.hpp:789
void identifyInterfaceParallelAndDistance(DomainPtr_Type domainOther, vec_int_Type interfaceID_vec)
Itentify interface parallal and distance.
Definition Domain_def.hpp:573
void toDofID(UN dim, GO nodeID, LO localDofNumber, GO &dofID)
Hilfsfunktion fuer buildLocalInterfaceIDInGlobal(). Gibt fuer eine gegebene nodeID die entsprechende ...
Definition Domain_def.hpp:900
vec_long_Type getLocalInterfaceIDInGlobal() const
Get local interface id in global.
Definition Domain_def.hpp:906
void readMeshSize(std::string filename, std::string delimiter)
Reading mesh size.
Definition Domain_def.hpp:291
void buildUniqueInterfaceMaps()
Build unique node and dof interfaceMap in interface numbering.
Definition Domain_def.hpp:695
void partitionMesh(bool partitionDistance=false)
Partition mesh according to number of processors. Partition with parmetis.
Definition Domain_def.hpp:302
MapConstPtr_Type getMapUnique() const
MultiVectorPtr_Type getNodeListMV() const
Get node list in multi vector point.
Definition Domain_def.hpp:984
MapConstPtr_Type getOtherGlobalInterfaceMapVecFieldUnique() const
Get other interface vec field map unique (for fsi coupling block c4)
Definition Domain_def.hpp:775
LO getNumElements() const
Get local number of elements (on your processor)
Definition Domain_def.hpp:533
void setMesh(MeshUnstrPtr_Type meshUnstr)
Settng mesh from domain.
Definition Domain_def.hpp:389
ElementsPtr_Type getElementsC() const
Get the elements (on your processor) as Elements_Type.
Definition Domain_def.hpp:502
void toNodeID(UN dim, GO dofID, GO &nodeID, LO &localDofNumber)
Hilfsfunktion fuer buildLocalInterfaceIDInGlobal(). Gibt fuer eine gegebene nodeID die entsprechende ...
Definition Domain_def.hpp:893
int findInPointsUnique(const vec_dbl_Type &x) const
Find in points unique.
Definition Domain_def.hpp:943
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:472
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:688
std::string getFEType() const
Finite element discretization. Represented as string, i.e., P2.
Definition Domain_def.hpp:437
LO getNumPoints(std::string type="Unique") const
Get local number of points of type 'type' (unique/repeated)
Definition Domain_def.hpp:539
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:277
MapConstPtr_Type getEdgeMap() const
Get map of edges.
Definition Domain_def.hpp:466
GO getNumElementsGlobal() const
Get global number of elements.
Definition Domain_def.hpp:527
void initWithDomain(DomainPtr_Type domainsP1)
Initialize domain with already existing domain.
Definition Domain_def.hpp:363
void exportElementFlags(std::string name="default")
Exporting Paraview file displaying element flags of the underlying mesh.
Definition Domain_def.hpp:1102
MapConstPtr_Type getGlobalInterfaceMapUnique() const
Get interface map unique (for fsi coupling block c4)
Definition Domain_def.hpp:762
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:344
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:478
void exportNodeFlags(std::string name="default")
Exporting Paraview file displaying node flags of the underlying mesh.
Definition Domain_def.hpp:999
MapConstPtr_Type getInterfaceMapVecFieldUnique() const
Get interface vector field map unique.
Definition Domain_def.hpp:755
void exportElementOrientation(std::string name="default")
Exporting Paraview file displaying element volume of underlying mesh.
Definition Domain_def.hpp:1070
void info() const
Information about the domain.
Definition Domain_def.hpp:141
MapConstPtr_Type getElementMap() const
Get map of elements.
Definition Domain_def.hpp:460
vec_int_ptr_Type getBCFlagRepeated() const
Get vector of the flags corrsponding to the repeated points (on your processor)
Definition Domain_def.hpp:484
void setReferenceConfiguration()
Set reference configuration.
Definition Domain_def.hpp:671
MapConstPtr_Type getGlobalInterfaceMapVecFieldUnique() const
Get interface vec field map unique (for fsi coupling block c4)
Definition Domain_def.hpp:769
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:666
void exportMesh(bool exportEdges=false, bool exportSurfaces=false, std::string exportMesh="export.mesh")
Exporting Mesh.
Definition Domain_def.hpp:410
MapConstPtr_Type getInterfaceMapUnique() const
Get interface map unique.
Definition Domain_def.hpp:748
void setDummyInterfaceDomain(DomainPtr_Type domain)
Set dummy interface domain.
Definition Domain_def.hpp:912
void calculateDistancesToInterface()
Calculate distance to interface.
Definition Domain_def.hpp:583
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:327
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:509
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.cpp:5