Tri::Tri(int i_d, char ty, int L, int Qa, int Qb, int Qc, Coord *X){ int i; if(!Tri_wk.get()) Tri_work(); id = i_d; type = ty; state = 'p'; Nverts = 3; Nedges = 3; Nfaces = 1; vert = (Vert *)calloc(Nverts,sizeof(Vert)); edge = (Edge *)calloc(Nedges,sizeof(Edge)); face = (Face *)calloc(Nfaces,sizeof(Face)); lmax = L; interior_l = 0; Nmodes = L*(L+1)/2; Nbmodes = Nmodes - (L-3)*(L-2)/2; qa = Qa; qb = Qb; qc = Qc; qtot = qa*qb; /* set vertex solve mask to 1 by default */ for(i = 0; i < Nverts; ++i){ vert[i].id = i; vert[i].eid = id; vert[i].solve = 1; vert[i].x = X->x[i]; vert[i].y = X->y[i]; } /* construct edge system */ for(i = 0; i < Nedges; ++i){ edge[i].id = i; edge[i].eid = id; edge[i].l = L-2; } /* construct face system */ for(i = 0; i < Nfaces; ++i){ face[i].id = i; face[i].eid = id; face[i].l = max(0,L-3); } vert[0].hj = (double*) 0; face[0].hj = (double**) 0; h = (double**) 0; hj_3d = (double***)0; h_3d = (double***)0; curve = (Curve*)NULL; curvX = (Cmodes*)NULL; }
Tri::Tri(Element *E) { if(!Tri_wk.get()) Tri_work(); id = E->id; type = E->type; state = 'p'; Nverts = 3; Nedges = 3; Nfaces = 1; vert = (Vert *)calloc(Nverts,sizeof(Vert)); edge = (Edge *)calloc(Nedges,sizeof(Edge)); face = (Face *)calloc(Nfaces,sizeof(Face)); lmax = E->lmax; interior_l = E->interior_l; Nmodes = E->Nmodes; Nbmodes = E->Nbmodes; qa = E->qa; qb = E->qb; qc = 0; qtot = E->qtot; memcpy(vert,E->vert,Nverts*sizeof(Vert)); memcpy(edge,E->edge,Nedges*sizeof(Edge)); memcpy(face,E->face,Nfaces*sizeof(Face)); /* set memory */ vert[0].hj = (double*) 0; face[0].hj = (double**) 0; h = (double**) 0; hj_3d = (double***)0; h_3d = (double***)0; curve = E->curve; curvX = E->curvX; geom = E->geom; dgL = E->dgL; group = E->group; }
Element_List *Grid::gen_aux_field(){ int L, qa, qb, qc=0, k; char buf[BUFSIZ]; char buf_a[BUFSIZ]; Element **new_E; register int i; option_set("NZ",1); option_set("NZTOT",1); /* set up modes and quadrature points */ if(!( L = iparam("MODES"))) {fputs("ReadMesh: Number of modes not specified\n",stderr);exit(-1);} /* note quadrature order reset for variable order runs */ if(qa = iparam("LQUAD")); else qa = L + 1; if(qb = iparam("MQUAD")); else qb = L; if(qc = iparam("NQUAD")); else qc = L; iparam_set("ELEMENTS", nel); /* Set up a new element vector */ QGmax = max(max(qa,qb),qc); LGmax = L; new_E = (Element**) malloc(nel*sizeof(Element*)); Coord X; X.x = dvector(0,Max_Nverts-1); X.y = dvector(0,Max_Nverts-1); X.z = dvector(0,Max_Nverts-1); /* Read in mesh information */ for(k = 0; k < nel; k++) { for(i=0;i<nverts[k];++i){ X.x[i] = xcoords[vertids[k][vertexmap[k][i]]]; X.y[i] = ycoords[vertids[k][vertexmap[k][i]]]; X.z[i] = zcoords[vertids[k][vertexmap[k][i]]]; } switch(nverts[k]){ case 4: new_E[k] = new Tet(k,'u', L, qa, qb, qb, &X); break; case 8: new_E[k] = new Hex(k,'u', L, qa, qa, qa, &X); break; case 6: new_E[k] = new Prism(k,'u', L, qa, qa, qb, &X); break; case 5: new_E[k] = new Pyr(k,'u', L, qa, qa, qb, &X); break; } } for(k = 0; k < nel-1; ++k) new_E[k]->next = new_E[k+1]; new_E[k]->next = (Element*) NULL; Element_List* E_List = (Element_List*) new Element_List(new_E, nel); E_List->Cat_mem(); Tri_work(); Quad_work(); for(k = 0; k < nel; ++k) new_E[k]->set_curved_elmt(E_List); for(k = 0; k < nel; ++k) new_E[k]->set_geofac(); return E_List; }