Information Technology Reference
In-Depth Information
P3
P2
IGA
IGAElement
IGAPoint
P0
P1
(a) PetIGA classes abstractions
(b) PetIGA classes relation
Fig. 1. Main concepts of PetIGA framework
considered, no connectivity array is stored, and everything is computed on the fly
for each element. The IGAElement object has an iterator through the IGAPoint
object, as expressed in figure 1b.
From the perspective of the user, the IGAPoint class is the most important
one, and actually, the only one a PetIGA user must care about. An IGAPoint
object gets all the information from the IGAElement , which refers to a specific
quadrature (or collocation) point. Within that object, the shape field stores
the shape functions and its nonzero derivatives on that quadrature point (see
listing 1.1, lines 5,6). The rationale behind these abstractions stems from wanting
the user to only have to focus on the variational formulation of the problem.
As an example, let us consider the C function SystemGalerkin , shown in list-
ing 1.1, that a user has to write to compute a discrete scalar Laplacian. This is
part of the Poisson demo tutorial included in the PetIGA repository [2,17].
PetscErrorCode SystemGalerkin ( IGAPoint p, PetscScalar *K, PetscScalar *F,
void *ctx)
1
{
PetscInt nen = p->nen;
PetscInt dim = p->dim;
3
const PetscReal *N0 = (typeof(N0)) p->shape[0];
const PetscReal (*N1)[dim] = (typeof(N1)) p->shape[1];
5
7
PetscInt a,b;
for (a=0; a<nen; a++) {
for (b=0; b<nen; b++)
9
K[a*nen+b] = DOT(dim,N1[a],N1[b]);
F[a] = N0[a] * 1.0;
11
}
return 0;
13
}
15
Listing 1.1. Callback function to build the discrete Laplacian and an unit force
vector. Part of PetIGA demo code Poisson.c
 
 
 
Search WWH ::




Custom Search