- Timestamp:
- 09/16/13 09:43:55 (12 years ago)
- Location:
- issm/trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk
- Property svn:ignore
-
old new 1 nightlylog 2 configure.sh 1 3 par 2 4 ad
-
- Property svn:mergeinfo changed
/issm/trunk-jpl merged: 15397-15401,15403-15487,15489-15701,15704-15735,15737-16076,16082-16133
- Property svn:ignore
-
issm/trunk/src
- Property svn:mergeinfo changed
-
issm/trunk/src/c
- Property svn:ignore
-
old new 14 14 probe.results 15 15 stXXXX* 16 16 .deps 17 .dirstamp
-
- Property svn:ignore
-
issm/trunk/src/c/modules/ModelProcessorx
-
Property svn:ignore
set to
.deps
.dirstamp
-
Property svn:ignore
set to
-
issm/trunk/src/c/modules/ModelProcessorx/NodesPartitioning.cpp
r15396 r16137 20 20 void NodesPartitioning(bool** pmy_nodes,bool* my_elements, int* my_vertices, IoModel* iomodel, bool continuous){ 21 21 22 /*First thing, this is a new partition for a new analysis_type, therefore, to avoid a leak, erase the nodes partition that might come through pmy_nodes: */23 xDelete<bool>(*pmy_nodes);24 25 /*Now, depending on whether we are running galerkin discontinous or continuous elements, carry out a different partition of the nodes: */26 22 if(continuous==true) 27 23 ContinuousGalerkinNodesPartitioning(pmy_nodes,my_elements, my_vertices, iomodel); … … 32 28 void ContinuousGalerkinNodesPartitioning(bool** pmy_nodes,bool* my_elements, int* my_vertices, IoModel* iomodel){ 33 29 34 /*as many nodes as there are vertices */35 int numberofvertices;36 37 30 /*output: */ 38 bool* my_nodes=NULL; 39 40 /*Fetch parameters: */ 41 iomodel->Constant(&numberofvertices,MeshNumberofverticesEnum); 42 43 my_nodes=xNew<bool>(numberofvertices); 44 for(int i=0;i<numberofvertices;i++) my_nodes[i]=(bool)my_vertices[i]; 31 bool* my_nodes=xNew<bool>(iomodel->numberofvertices); 32 for(int i=0;i<iomodel->numberofvertices;i++) my_nodes[i]=(bool)my_vertices[i]; 45 33 46 34 /*Assign output pointers:*/ … … 50 38 void DiscontinuousGalerkinNodesPartitioning(bool** pmy_nodes,bool* my_elements, int* my_vertices, IoModel* iomodel){ 51 39 52 int numberofelements; 40 /* Each element has it own nodes (as many as vertices) + additional nodes 41 * from neighboring elements for each face. This yields to a very different 42 * partition for the nodes and the vertices. The vertices are similar to 43 * continuous galerkin, but the nodes partitioning involves faces, which 44 * messes up sorting of ids. */ 53 45 54 /*Fetch parameters: */ 55 iomodel->Constant(&numberofelements,MeshNumberofelementsEnum); 56 57 /*each element has it own nodes (as many as vertices) + additional nodes from neighbouring elements for each edge. This yields to a very different partition for 58 * the nodes and the vertices. The vertices are similar to continuous galerkin, but the nodes partitioning involves edges, which mess up sorting of 59 * ids. */ 60 61 int i,j; 62 int dim; 63 64 /*output: */ 65 bool* my_nodes=NULL; 66 67 int i1,i2; 46 /*Intermediaries*/ 47 int i,i1,i2; 68 48 int cols; 69 49 int e1,e2; 70 50 int pos; 71 int numberofedges;72 int *edges = NULL;73 int *elements = NULL;74 51 75 /* Fetch parameters:*/76 iomodel->Constant(&dim,MeshDimensionEnum);52 /*Get faces and elements*/ 53 CreateEdges(iomodel); 77 54 78 55 /*Build discontinuous node partitioning 79 56 * - there are three nodes per element (discontinous) 80 57 * - for each element present of each partition, its three nodes will be in this partition 81 * - the edges require the dofs of the 2 nodes of each elements sharing the edge.82 * if the 2 elements sharing the edge are on 2 different cpus, we must duplicate83 * the two nodes that are not on the cpus so that the edge can access the dofs of58 * - the faces require the dofs of the 2 nodes of each elements sharing the face. 59 * if the 2 elements sharing the face are on 2 different cpus, we must duplicate 60 * the two nodes that are not on the cpus so that the face can access the dofs of 84 61 * all its 4 nodes 85 62 */ 86 63 87 64 /*Allocate*/ 88 my_nodes=xNewZeroInit<bool>(3*numberofelements);65 bool* my_nodes=xNewZeroInit<bool>(3*iomodel->numberofelements); 89 66 90 67 /*First: add all the nodes of all the elements belonging to this cpu*/ 91 if (dim==2){92 for (i=0;i< numberofelements;i++){68 if(iomodel->dim==2){ 69 for (i=0;i<iomodel->numberofelements;i++){ 93 70 if (my_elements[i]){ 94 71 my_nodes[3*i+0]=true; … … 104 81 /*Second: add all missing nodes*/ 105 82 106 /*Get edges and elements*/ 107 iomodel->FetchData(&edges,&numberofedges,&cols,MeshEdgesEnum); 108 iomodel->FetchData(&elements,NULL,NULL,MeshElementsEnum); 109 if (cols!=4) _error_("field edges should have 4 columns"); 83 /*Get faces and elements*/ 84 CreateFaces(iomodel); 110 85 111 86 /*!All elements have been partitioned above, only create elements for this CPU: */ 112 for (i=0;i<numberofedges;i++){87 for(int i=0;i<iomodel->numberoffaces;i++){ 113 88 114 89 /*Get left and right elements*/ 115 e1= edges[4*i+2]-1; //edges are [node1 node2 elem1 elem2]116 e2= edges[4*i+3]-1; //edges are [node1 node2 elem1 elem2]90 e1=iomodel->faces[4*i+2]-1; //faces are [node1 node2 elem1 elem2] 91 e2=iomodel->faces[4*i+3]-1; //faces are [node1 node2 elem1 elem2] 117 92 118 93 /* 1) If the element e1 is in the current partition 119 * 2) and if the edge of the element is shared by another element (internal edge)94 * 2) and if the face of the element is shared by another element (internal face) 120 95 * 3) and if this element is not in the same partition: 121 96 * we must clone the nodes on this partition so that the loads (Numericalflux) … … 124 99 125 100 /*1: Get vertices ids*/ 126 i1= edges[4*i+0];127 i2= edges[4*i+1];101 i1=iomodel->faces[4*i+0]; 102 i2=iomodel->faces[4*i+1]; 128 103 129 104 /*2: Get the column where these ids are located in the index*/ 130 105 pos=UNDEF; 131 for( j=0;j<3;j++){132 if (elements[3*e2+j]==i1) pos=j;106 for(int j=0;j<3;j++){ 107 if(iomodel->elements[3*e2+j]==i1) pos=j; 133 108 } 134 109 135 110 /*3: We have the id of the elements and the position of the vertices in the index 136 111 * we can now create the corresponding nodes:*/ 137 if 112 if(pos==0){ 138 113 my_nodes[e2*3+0]=true; 139 114 my_nodes[e2*3+2]=true; … … 143 118 my_nodes[e2*3+0]=true; 144 119 } 145 else if 120 else if(pos==2){ 146 121 my_nodes[e2*3+2]=true; 147 122 my_nodes[e2*3+1]=true; 148 123 } 149 124 else{ 150 _error_("Problem in edges creation");125 _error_("Problem in faces creation"); 151 126 } 152 127 } 153 128 } 154 129 155 /*Free data: */ 156 xDelete<int>(elements); 157 xDelete<int>(edges); 158 159 /*Assign output pointers:*/ 130 /*Free data and assign output pointers */ 160 131 *pmy_nodes=my_nodes; 161 132 }
Note:
See TracChangeset
for help on using the changeset viewer.