Lines Matching refs:dim

74 static void laplacian_f1(PetscInt dim, PetscInt Nf, PetscInt NfAux, const PetscInt uOff[], const Pe…  in laplacian_f1()  argument
77 for (d = 0; d < dim; ++d) f1[d] = u_x[d]; in laplacian_f1()
80 static void laplacian_g3(PetscInt dim, PetscInt Nf, PetscInt NfAux, const PetscInt uOff[], const Pe… in laplacian_g3() argument
83 for (d = 0; d < dim; ++d) g3[d * dim + d] = 1.0; in laplacian_g3()
90 static void f0_q(PetscInt dim, PetscInt Nf, PetscInt NfAux, const PetscInt uOff[], const PetscInt u… in f0_q() argument
92 for (PetscInt c = 0; c < dim; ++c) f0[c] += u[uOff[0] + c]; in f0_q()
95 static void f1_q(PetscInt dim, PetscInt Nf, PetscInt NfAux, const PetscInt uOff[], const PetscInt u… in f1_q() argument
97 for (PetscInt d = 0; d < dim; ++d) f1[d * dim + d] += u[uOff[1]]; in f1_q()
101 static void g0_qq(PetscInt dim, PetscInt Nf, PetscInt NfAux, const PetscInt uOff[], const PetscInt … in g0_qq() argument
104 for (c = 0; c < dim; ++c) g0[c * dim + c] += 1.0; in g0_qq()
107 static void g2_qu(PetscInt dim, PetscInt Nf, PetscInt NfAux, const PetscInt uOff[], const PetscInt … in g2_qu() argument
109 for (PetscInt d = 0; d < dim; ++d) g2[d * dim + d] += 1.0; in g2_qu()
112 static void g1_uq(PetscInt dim, PetscInt Nf, PetscInt NfAux, const PetscInt uOff[], const PetscInt … in g1_uq() argument
114 for (PetscInt d = 0; d < dim; ++d) g1[d * dim + d] += 1.0; in g1_uq()
122 PetscInt dim; in CreateFEM() local
125 PetscCall(DMGetDimension(dm, &dim)); in CreateFEM()
130 …PetscCall(PetscFECreateDefault(PETSC_COMM_SELF, dim, dim, simplex, "field_", PETSC_DETERMINE, &feq… in CreateFEM()
132 …PetscCall(PetscFECreateDefault(PETSC_COMM_SELF, dim, 1, simplex, "potential_", PETSC_DETERMINE, &f… in CreateFEM()
148 PetscCall(PetscFECreateDefault(PETSC_COMM_SELF, dim, 1, simplex, NULL, PETSC_DETERMINE, &feu)); in CreateFEM()
187 PetscInt dim; in CreateSwarm() local
190 PetscCall(DMGetDimension(dm, &dim)); in CreateSwarm()
193 PetscCall(DMSetDimension(*sw, dim)); in CreateSwarm()
197 PetscCall(DMSwarmRegisterPetscDatatypeField(*sw, "velocity", dim, PETSC_REAL)); in CreateSwarm()
199 PetscCall(DMSwarmRegisterPetscDatatypeField(*sw, "initCoordinates", dim, PETSC_REAL)); in CreateSwarm()
200 PetscCall(DMSwarmRegisterPetscDatatypeField(*sw, "initVelocity", dim, PETSC_REAL)); in CreateSwarm()
201 PetscCall(DMSwarmRegisterPetscDatatypeField(*sw, "E_field", dim, PETSC_REAL)); in CreateSwarm()
235 PetscInt dim, d, Np, p, q; in ComputeFieldAtParticles_Coulomb() local
241 PetscCall(DMGetDimension(sw, &dim)); in ComputeFieldAtParticles_Coulomb()
246 PetscReal *pcoord = &coords[p * dim]; in ComputeFieldAtParticles_Coulomb()
247 PetscReal *pE = &E[p * dim]; in ComputeFieldAtParticles_Coulomb()
250 PetscReal *qcoord = &coords[q * dim]; in ComputeFieldAtParticles_Coulomb()
254 for (d = 0; d < dim; ++d) rpq[d] = pcoord[d] - qcoord[d]; in ComputeFieldAtParticles_Coulomb()
255 r = DMPlex_NormD_Internal(dim, rpq); in ComputeFieldAtParticles_Coulomb()
256 for (d = 0; d < dim; ++d) pE[d] += rpq[d] / PetscPowRealInt(r, 3); in ComputeFieldAtParticles_Coulomb()
271 PetscInt dim, d, cStart, cEnd, c, Np; in ComputeFieldAtParticles_Primal() local
277 PetscCall(DMGetDimension(sw, &dim)); in ComputeFieldAtParticles_Primal()
342 PetscCall(DMGetWorkArray(dm, Ncp * dim, MPIU_REAL, &pcoord)); in ComputeFieldAtParticles_Primal()
343 PetscCall(DMGetWorkArray(dm, Ncp * dim, MPIU_REAL, &refcoord)); in ComputeFieldAtParticles_Primal()
345 for (d = 0; d < dim; ++d) pcoord[cp * dim + d] = coords[points[cp] * dim + d]; in ComputeFieldAtParticles_Primal()
354 for (d = 0; d < dim; ++d) E[p * dim + d] = 0.; in ComputeFieldAtParticles_Primal()
355 …Call(PetscFEFreeInterpolateGradient_Static(fe, basisDer, clPhi, dim, invJ, NULL, cp, &E[p * dim])); in ComputeFieldAtParticles_Primal()
356 for (d = 0; d < dim; ++d) E[p * dim + d] *= -1.0; in ComputeFieldAtParticles_Primal()
359 PetscCall(DMRestoreWorkArray(dm, Ncp * dim, MPIU_REAL, &pcoord)); in ComputeFieldAtParticles_Primal()
360 PetscCall(DMRestoreWorkArray(dm, Ncp * dim, MPIU_REAL, &refcoord)); in ComputeFieldAtParticles_Primal()
381 PetscInt dim, d, cStart, cEnd, c, Np, pot_field = 1; in ComputeFieldAtParticles_Mixed() local
387 PetscCall(DMGetDimension(sw, &dim)); in ComputeFieldAtParticles_Mixed()
459 PetscCall(DMGetWorkArray(dm, Ncp * dim, MPIU_REAL, &pcoord)); in ComputeFieldAtParticles_Mixed()
460 PetscCall(DMGetWorkArray(dm, Ncp * dim, MPIU_REAL, &refcoord)); in ComputeFieldAtParticles_Mixed()
462 for (d = 0; d < dim; ++d) pcoord[cp * dim + d] = coords[points[cp] * dim + d]; in ComputeFieldAtParticles_Mixed()
470 for (d = 0; d < dim; ++d) E[p * dim + d] = 0.; in ComputeFieldAtParticles_Mixed()
473 PetscCall(PetscFEInterpolateAtPoints_Static(fe, tab, clPhi, &feGeometry, cp, &E[p * dim])); in ComputeFieldAtParticles_Mixed()
477 PetscCall(DMRestoreWorkArray(dm, Ncp * dim, MPIU_REAL, &pcoord)); in ComputeFieldAtParticles_Mixed()
478 PetscCall(DMRestoreWorkArray(dm, Ncp * dim, MPIU_REAL, &refcoord)); in ComputeFieldAtParticles_Mixed()
491 PetscInt dim, Np; in ComputeFieldAtParticles() local
497 PetscCall(DMGetDimension(sw, &dim)); in ComputeFieldAtParticles()
500 PetscCall(PetscArrayzero(E, Np * dim)); in ComputeFieldAtParticles()
528 PetscInt dim, d, Np, p; in RHSFunction() local
532 PetscCall(DMGetDimension(sw, &dim)); in RHSFunction()
542 Np /= 2 * dim; in RHSFunction()
544 const PetscReal x0 = coords[p * dim + 0]; in RHSFunction()
545 const PetscReal vy0 = vel[p * dim + 1]; in RHSFunction()
548 for (d = 0; d < dim; ++d) { in RHSFunction()
549 g[(p * 2 + 0) * dim + d] = u[(p * 2 + 1) * dim + d]; in RHSFunction()
550 g[(p * 2 + 1) * dim + d] = E[p * dim + d] - PetscSqr(omega) * u[(p * 2 + 0) * dim + d]; in RHSFunction()
571 PetscInt dim, d, Np, p, rStart; in RHSJacobian() local
575 PetscCall(DMGetDimension(sw, &dim)); in RHSJacobian()
580 Np /= 2 * dim; in RHSJacobian()
582 const PetscReal x0 = coords[p * dim + 0]; in RHSJacobian()
583 const PetscReal vy0 = vel[p * dim + 1]; in RHSJacobian()
587 for (d = 0; d < dim; ++d) { in RHSJacobian()
588 const PetscInt rows[2] = {(p * 2 + 0) * dim + d + rStart, (p * 2 + 1) * dim + d + rStart}; in RHSJacobian()
604 PetscInt Np, p, dim, d; in RHSFunctionX() local
608 PetscCall(DMGetDimension(sw, &dim)); in RHSFunctionX()
610 Np /= dim; in RHSFunctionX()
614 for (d = 0; d < dim; ++d) xres[p * dim + d] = v[p * dim + d]; in RHSFunctionX()
629 PetscInt Np, p, dim, d; in RHSFunctionV() local
633 PetscCall(DMGetDimension(sw, &dim)); in RHSFunctionV()
640 PetscCheck(dim == 2, PETSC_COMM_SELF, PETSC_ERR_ARG_WRONG, "Dimension must be 2"); in RHSFunctionV()
644 Np /= dim; in RHSFunctionV()
646 const PetscReal x0 = coords[p * dim + 0]; in RHSFunctionV()
647 const PetscReal vy0 = vel[p * dim + 1]; in RHSFunctionV()
650 for (d = 0; d < dim; ++d) vres[p * dim + d] = E[p * dim + d] - PetscSqr(omega) * x[p * dim + d]; in RHSFunctionV()
665 PetscInt dim, d, Np, p, rStart; in RHSJacobianS() local
669 PetscCall(DMGetDimension(sw, &dim)); in RHSJacobianS()
672 Np /= 2 * dim; in RHSJacobianS()
674 for (d = 0; d < dim; ++d) { in RHSJacobianS()
675 const PetscInt rows[2] = {(p * 2 + 0) * dim + d + rStart, (p * 2 + 1) * dim + d + rStart}; in RHSJacobianS()
689 PetscInt dim, Np, cStart, cEnd; in RHSObjectiveF() local
695 PetscCall(DMGetDimension(sw, &dim)); in RHSObjectiveF()
710 Np /= 2 * dim; in RHSObjectiveF()
719 const PetscReal x0 = coords[p * dim + 0]; in RHSObjectiveF()
720 const PetscReal vy0 = vel[p * dim + 1]; in RHSObjectiveF()
722 …const PetscReal v2 = DMPlex_DotRealD_Internal(dim, &u[(p * 2 + 1) * dim], &u[(p * 2 + 1) * dim]… in RHSObjectiveF()
723 …const PetscReal x2 = DMPlex_DotRealD_Internal(dim, &u[(p * 2 + 0) * dim], &u[(p * 2 + 0) * dim]… in RHSObjectiveF()
749 PetscInt dim, d, Np, p; in RHSFunctionG() local
753 PetscCall(DMGetDimension(sw, &dim)); in RHSFunctionG()
767 const PetscReal x0 = coords[p * dim + 0]; in RHSFunctionG()
768 const PetscReal vy0 = vel[p * dim + 1]; in RHSFunctionG()
770 for (d = 0; d < dim; ++d) { in RHSFunctionG()
771 …g[(p * 2 + 0) * dim + d] = -(q_p / m_p) * E[p * dim + d] + PetscSqr(omega) * u[(p * 2 + 0) * dim +… in RHSFunctionG()
772 g[(p * 2 + 1) * dim + d] = u[(p * 2 + 1) * dim + d]; in RHSFunctionG()
787 PetscInt dim, Np; in CreateSolution() local
791 PetscCall(DMGetDimension(sw, &dim)); in CreateSolution()
794 PetscCall(VecSetBlockSize(u, dim)); in CreateSolution()
795 PetscCall(VecSetSizes(u, 2 * Np * dim, PETSC_DECIDE)); in CreateSolution()
813 PetscInt dim, Np; in SetProblem() local
815 PetscCall(DMGetDimension(sw, &dim)); in SetProblem()
818 PetscCall(MatSetSizes(J, 2 * Np * dim, 2 * Np * dim, PETSC_DECIDE, PETSC_DECIDE)); in SetProblem()
819 PetscCall(MatSetBlockSize(J, 2 * dim)); in SetProblem()
831 PetscInt dim, Np, rstart; in SetProblem() local
834 PetscCall(DMGetDimension(sw, &dim)); in SetProblem()
837 PetscCall(ISCreateStride(PETSC_COMM_WORLD, Np, (rstart / dim) + 0, 2, &istmp)); in SetProblem()
839 PetscCall(ISCreateBlock(PETSC_COMM_WORLD, dim, Np, idx, PETSC_COPY_VALUES, &isx)); in SetProblem()
842 PetscCall(ISCreateStride(PETSC_COMM_WORLD, Np, (rstart / dim) + 1, 2, &istmp)); in SetProblem()
844 PetscCall(ISCreateBlock(PETSC_COMM_WORLD, dim, Np, idx, PETSC_COPY_VALUES, &isv)); in SetProblem()
861 PetscErrorCode circleSingleX(PetscInt dim, PetscReal time, const PetscReal unused[], PetscInt p, Pe… in circleSingleX() argument
868 PetscErrorCode circleSingleV(PetscInt dim, PetscReal time, const PetscReal unused[], PetscInt p, Pe… in circleSingleV() argument
876 PetscErrorCode circleMultipleX(PetscInt dim, PetscReal time, const PetscReal unused[], PetscInt p, … in circleMultipleX() argument
888 PetscErrorCode circleMultipleV(PetscInt dim, PetscReal time, const PetscReal unused[], PetscInt p, … in circleMultipleV() argument
969 PetscInt dim, Np, p; in ComputeError() local
975 PetscCall(DMGetDimension(sw, &dim)); in ComputeError()
982 Np /= 2 * dim; in ComputeError()
985 const PetscReal r0 = DMPlex_NormD_Internal(dim, &coords[p * dim]); in ComputeError()
986 const PetscReal th0 = PetscAtan2Real(coords[p * dim + 1], coords[p * dim + 0]); in ComputeError()
987 const PetscReal v0 = DMPlex_NormD_Internal(dim, &vel[p * dim]); in ComputeError()
991 const PetscScalar *x = &u[(p * 2 + 0) * dim]; in ComputeError()
992 const PetscScalar *v = &u[(p * 2 + 1) * dim]; in ComputeError()
997 for (d = 0; d < dim; ++d) { in ComputeError()
998 e[(p * 2 + 0) * dim + d] = x[d] - xe[d]; in ComputeError()
999 e[(p * 2 + 1) * dim + d] = v[d] - ve[d]; in ComputeError()
1002 const PetscReal en = 0.5 * DMPlex_DotRealD_Internal(dim, v, v); in ComputeError()
1004 … p, (double)DMPlex_NormD_Internal(dim, &e[(p * 2 + 0) * dim]), (double)DMPlex_NormD_Internal(dim, … in ComputeError()
1022 PetscInt dim, d, Np, p, q; in EnergyMonitor() local
1027 PetscCall(DMGetDimension(sw, &dim)); in EnergyMonitor()
1030 Np /= 2 * dim; in EnergyMonitor()
1035 …const PetscReal v2 = DMPlex_DotRealD_Internal(dim, &u[(p * 2 + 1) * dim], &u[(p * 2 + 1) * dim in EnergyMonitor()
1036 PetscReal *pcoord = &coords[p * dim]; in EnergyMonitor()
1044 PetscReal *qcoord = &coords[q * dim]; in EnergyMonitor()
1046 for (d = 0; d < dim; ++d) rpq[d] = pcoord[d] - qcoord[d]; in EnergyMonitor()
1047 r = DMPlex_NormD_Internal(dim, rpq); in EnergyMonitor()
1051 for (d = 0; d < dim; ++d) enEM += E[p * dim + d]; in EnergyMonitor()