# PetIGA / src / petigaval.F90

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181``` ```! -*- f90 -*- #include "petscconf.h" #if defined(PETSC_USE_COMPLEX) #define scalar complex #else #define scalar real #endif subroutine IGA_GetGeomMap(nen,nsd,N,C,X) & bind(C, name="IGA_GetGeomMap") use PetIGA implicit none integer(kind=IGA_INT ), intent(in),value :: nen,nsd real (kind=IGA_REAL), intent(in) :: N(nen) real (kind=IGA_REAL), intent(in) :: C(nsd,nen) real (kind=IGA_REAL), intent(out) :: X(nsd) !integer(kind=IGA_INT ) :: a !X = 0 !do a = 1, nen ! X = X + N(a) * C(:,a) !end do X = matmul(C,N) end subroutine IGA_GetGeomMap subroutine IGA_GetGradMap(nen,nsd,dim,N,C,F) & bind(C, name="IGA_GetGradMap") use PetIGA implicit none integer(kind=IGA_INT ), intent(in),value :: nen,nsd,dim real (kind=IGA_REAL), intent(in) :: N(dim,nen) real (kind=IGA_REAL), intent(in) :: C(nsd,nen) real (kind=IGA_REAL), intent(out) :: F(dim,nsd) F = matmul(N,transpose(C)) end subroutine IGA_GetGradMap subroutine IGA_GetGradMapI(nen,nsd,dim,N,C,G) & bind(C, name="IGA_GetGradMapI") use PetIGA implicit none integer(kind=IGA_INT ), intent(in),value :: nen,nsd,dim real (kind=IGA_REAL), intent(in) :: N(dim,nen) real (kind=IGA_REAL), intent(in) :: C(nsd,nen) real (kind=IGA_REAL), intent(out) :: G(nsd,dim) real (kind=IGA_REAL) :: F(dim,nsd) real (kind=IGA_REAL) :: M(nsd,nsd), invM(nsd,nsd) F = matmul(N,transpose(C)) M = matmul(transpose(F),F) invM = Inverse(nsd,Determinant(nsd,M),M) G = matmul(invM,transpose(F)) contains include 'petigainv.f90.in' end subroutine IGA_GetGradMapI subroutine IGA_GetValue(nen,dof,N,U,V) & bind(C, name="IGA_GetValue") use PetIGA implicit none integer(kind=IGA_INT ), intent(in),value :: nen,dof real (kind=IGA_REAL ), intent(in) :: N(nen) scalar (kind=IGA_SCALAR), intent(in) :: U(dof,nen) scalar (kind=IGA_SCALAR), intent(out) :: V(dof) integer(kind=IGA_INT ) :: a, i ! V = matmul(N,transpose(U)) V = 0 do a = 1, nen V = V + N(a) * U(:,a) end do end subroutine IGA_GetValue subroutine IGA_GetGrad(nen,dof,dim,N,U,V) & bind(C, name="IGA_GetGrad") use PetIGA implicit none integer(kind=IGA_INT ), intent(in),value :: nen,dof,dim real (kind=IGA_REAL ), intent(in) :: N(dim,nen) scalar (kind=IGA_SCALAR), intent(in) :: U(dof,nen) scalar (kind=IGA_SCALAR), intent(out) :: V(dim,dof) integer(kind=IGA_INT ) :: a, c ! V = matmul(N,transpose(U)) V = 0 do a = 1, nen do c = 1, dof V(:,c) = V(:,c) + N(:,a) * U(c,a) end do end do end subroutine IGA_GetGrad subroutine IGA_GetHess(nen,dof,dim,N,U,V) & bind(C, name="IGA_GetHess") use PetIGA implicit none integer(kind=IGA_INT ), intent(in),value :: nen,dof,dim real (kind=IGA_REAL ), intent(in) :: N(dim*dim,nen) scalar (kind=IGA_SCALAR), intent(in) :: U(dof,nen) scalar (kind=IGA_SCALAR), intent(out) :: V(dim*dim,dof) integer(kind=IGA_INT ) :: a, i ! V = matmul(N,transpose(U)) V = 0 do a = 1, nen do i = 1, dof V(:,i) = V(:,i) + N(:,a) * U(i,a) end do end do end subroutine IGA_GetHess subroutine IGA_GetDel2(nen,dof,dim,N,U,V) & bind(C, name="IGA_GetDel2") use PetIGA implicit none integer(kind=IGA_INT ), intent(in),value :: nen,dof,dim real (kind=IGA_REAL ), intent(in) :: N(dim,dim,nen) scalar (kind=IGA_SCALAR), intent(in) :: U(dof,nen) scalar (kind=IGA_SCALAR), intent(out) :: V(dof) integer(kind=IGA_INT ) :: a, c, i V = 0 do a = 1, nen do c = 1, dof do i = 1, dim V(c) = V(c) + N(i,i,a) * U(c,a) end do end do end do end subroutine IGA_GetDel2 subroutine IGA_GetDer3(nen,dof,dim,N,U,V) & bind(C, name="IGA_GetDer3") use PetIGA implicit none integer(kind=IGA_INT ), intent(in),value :: nen,dof,dim real (kind=IGA_REAL ), intent(in) :: N(dim*dim*dim,nen) scalar (kind=IGA_SCALAR), intent(in) :: U(dof,nen) scalar (kind=IGA_SCALAR), intent(out) :: V(dim*dim*dim,dof) integer(kind=IGA_INT ) :: a, i ! V = matmul(N,transpose(U)) V = 0 do a = 1, nen do i = 1, dof V(:,i) = V(:,i) + N(:,a) * U(i,a) end do end do end subroutine IGA_GetDer3 !subroutine IGA_GetDerivative(nen,dof,dim,der,N,U,V) & ! bind(C, name="IGA_GetDerivative") ! use PetIGA ! implicit none ! integer(kind=IGA_INT ), intent(in),value :: nen,dof ! integer(kind=IGA_INT ), intent(in),value :: dim,der ! real (kind=IGA_REAL ), intent(in) :: N(dim**der,nen) ! scalar (kind=IGA_SCALAR), intent(in) :: U(dof,nen) ! scalar (kind=IGA_SCALAR), intent(out) :: V(dim**der,dof) ! integer(kind=IGA_INT ) :: a, i ! ! V = matmul(N,transpose(U)) ! V = 0 ! do a = 1, nen ! do i = 1, dof ! V(:,i) = V(:,i) + N(:,a) * U(i,a) ! end do ! end do !end subroutine IGA_GetDerivative subroutine IGA_Interpolate(nen,dof,dim,der,N,U,V) & bind(C, name="IGA_Interpolate") use PetIGA implicit none integer(kind=IGA_INT ), intent(in),value :: nen,dof integer(kind=IGA_INT ), intent(in),value :: dim,der real (kind=IGA_REAL ), intent(in) :: N(dim**der,nen) scalar (kind=IGA_SCALAR), intent(in) :: U(dof,nen) scalar (kind=IGA_SCALAR), intent(out) :: V(dim**der,dof) integer(kind=IGA_INT ) :: a, i ! V = matmul(N,transpose(U)) V = 0 do a = 1, nen do i = 1, dof V(:,i) = V(:,i) + N(:,a) * U(i,a) end do end do end subroutine IGA_Interpolate ```