Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009 #if defined (ALBANY_LCM)
00010
00011 #include <stk_mesh/base/FieldData.hpp>
00012 #include "Topology.h"
00013
00014
00015
00016
00017
00018
00019
00020
00021 namespace LCM
00022 {
00023
00024 void
00025 Topology::divideSegmentsHalf()
00026 {
00027
00028 std::vector<Entity*>
00029 initial_entities_1D = getEntitiesByRank(*(getBulkData()),1);
00030 std::vector<Entity*> vector_nodes;
00031
00032
00033
00034 std::vector<size_t> request1(getSpaceDimension()+1, 0);
00035 request1[0]=initial_entities_1D.size();
00036 addEntities(request1);
00037
00038 std::vector<Entity*>
00039 initial_entities_0D = getEntitiesByRank(*(getBulkData()),0);
00040
00041
00042 for(unsigned int i=0; i< initial_entities_1D.size();i++){
00043 addRelation(*(initial_entities_1D[i]),*(initial_entities_0D[i]),2);
00044 }
00045
00046
00047 std::vector<size_t> requests_step1_2(getSpaceDimension() + 1, 0);
00048 requests_step1_2[1] = initial_entities_1D.size();
00049 addEntities(requests_step1_2);
00050 std::vector<Entity*>
00051 modified_entities_1D = getEntitiesByRank(*(getBulkData()),1);
00052
00053 for(unsigned int i=0; i<initial_entities_1D.size();i++){
00054
00055 stk::mesh::PairIterRelation _relations=initial_entities_1D[i]->relations();
00056
00057 for(unsigned j=0;j<_relations.size();j++){
00058 if(_relations[j].entity()->entity_rank()==0 && getLocalRelationId(*(initial_entities_1D[i]),*(_relations[j].entity()))== 1){
00059 addRelation(*(modified_entities_1D[i]),*(_relations[j].entity()),0);
00060 removeRelation(*(initial_entities_1D[i]),*(_relations[j].entity()),1);
00061 }
00062 addRelation(*(modified_entities_1D[i]),*(initial_entities_0D[i]),1);
00063 }
00064
00065 for(unsigned j=0;j<_relations.size();j++){
00066 if(_relations[j].entity()->entity_rank()==0 && getLocalRelationId(*(initial_entities_1D[i]),*(_relations[j].entity()))== 2){
00067 addRelation(*(initial_entities_1D[i]),*(_relations[j].entity()),1);
00068 removeRelation(*(initial_entities_1D[i]),*(_relations[j].entity()),2);
00069 }
00070 }
00071 }
00072
00073
00074 for(unsigned int i=0; i < initial_entities_1D.size();i++){
00075 stk::mesh::PairIterRelation _relations=initial_entities_1D[i]->relations();
00076 for(unsigned int j=0;j<_relations.size();j++){
00077 if(_relations[j].entity()->entity_rank()==2){
00078 addRelation(*(_relations[j].entity()),*(modified_entities_1D[i]),getNumberLowerRankEntities(*(_relations[j].entity())));
00079 }
00080 }
00081 }
00082
00083
00084 }
00085
00086 void
00087 Topology::addcentroid()
00088 {
00089
00090 std::vector<Entity*>
00091 initial_entities_2D = getEntitiesByRank(*(getBulkData()),2);
00092
00093
00094 std::vector<size_t> request2(getSpaceDimension()+1, 0);
00095 request2[0]=initial_entities_2D.size();
00096 addEntities(request2);
00097 }
00098
00099 void
00100 Topology::connectcentroid(){
00101
00102 std::vector<Entity*>
00103 initial_entities_2D = getEntitiesByRank(*(getBulkData()),2);
00104
00105
00106 std::vector<Entity*>
00107 modified_entities_0D = getEntitiesByRank(*(getBulkData()),0);
00108
00109
00110 std::vector<size_t> request2(getSpaceDimension()+1, 0);
00111 request2[1]=6*initial_entities_2D.size();
00112 addEntities(request2);
00113 std::vector<Entity*>
00114 modified_entities_1D = getEntitiesByRank(*(getBulkData()),1);
00115
00116
00117 for(unsigned int i=0; i < initial_entities_2D.size(); i++){
00118
00119
00120
00121 std::vector<Entity*>
00122 boundary_entities_0D= getBoundaryEntities(*(initial_entities_2D[i]),0);
00123
00124
00125 for(int j=0;j< getNumberLowerRankEntities(*(initial_entities_2D[i])); j++){
00126 addRelation(*(modified_entities_1D[6*i+j]),*(modified_entities_0D[i]),0);
00127 addRelation(*(modified_entities_1D[6*i+j]),*(boundary_entities_0D[j]),1);
00128 }
00129 }
00130 }
00131
00132 void
00133 Topology::addnewfaces()
00134 {
00135
00136 std::vector<Entity*>
00137 initial_entities_2D = getEntitiesByRank(*(getBulkData()),2);
00138
00139
00140 std::vector<size_t> request2(getSpaceDimension()+1, 0);
00141 request2[2]=6*initial_entities_2D.size();
00142 addEntities(request2);
00143
00144
00145 std::vector<Entity*>
00146 boundary_entities_1D= getBoundaryEntities(*(initial_entities_2D[0]),1);
00147
00148 for(unsigned i=0;i< boundary_entities_1D.size();i++){
00149 std::cout<<boundary_entities_1D[i]->identifier()<<std::endl;
00150 }
00151 }
00152 void
00153 Topology::connectnewfaces(){
00154
00155 std::vector<Entity*>
00156 initial_entities_2D = getEntitiesByRank(*(getBulkData()),2);
00157
00158 }
00159
00163 void
00164 Topology::barycentricSubdivision_()
00165 {
00166
00167 setHighestIds();
00168
00169 getBulkData()->modification_begin();
00170 divideSegmentsHalf();
00171 addcentroid();
00172 connectcentroid();
00173 addnewfaces();
00174 connectnewfaces();
00175
00176 getBulkData()->modification_end();
00177 }
00178
00179 }
00180
00181 #endif // #if defined (ALBANY_LCM)
00182
00183
00184
00185
00186
00187
00188
00189