Lines Matching refs:n

7     "# libCEED for Python examples\n",
8 "\n",
9 …oject.org/) (CEED) of the [Exascale Computing Project](https://www.exascaleproject.org/) (ECP).\n",
10 "\n",
18 "## Setting up libCEED for Python\n",
19 "\n",
36 "## CeedQFunction\n",
37 "\n",
38 … quadrature points. Hence, QFunctions are independent from element shape, resolution and order.\n",
39 "\n",
40 "![alt text][QFunctionSchematic]\n",
41 "\n",
58 "import libceed\n",
59 "import numpy as np\n",
60 "\n",
61 "ceed = libceed.Ceed()\n",
62 "\n",
63 "qf_setup = ceed.QFunctionByName(\"Mass1DBuild\")\n",
64 "qf_mass = ceed.QFunctionByName(\"MassApply\")\n",
65 "\n",
66 "print(qf_setup)\n",
83 "qf = ceed.IdentityQFunction(1, libceed.EVAL_INTERP, libceed.EVAL_INTERP)\n",
84 "\n",
85 "q = 8\n",
86 "\n",
87 "u_array = np.zeros(q, dtype=\"float64\")\n",
88 "for i in range(q):\n",
89 " u_array[i] = i*i\n",
90 "\n",
91 "u = ceed.Vector(q)\n",
92 "u.set_array(u_array, cmode=libceed.USE_POINTER)\n",
93 "v = ceed.Vector(q)\n",
94 "v.set_value(0)\n",
95 "\n",
96 "inputs = [ u ]\n",
97 "outputs = [ v ]\n",
98 "qf.apply(q, inputs, outputs)\n",
99 "\n",
116 "qf_setup = ceed.QFunctionByName(\"Mass1DBuild\")\n",
117 "qf_mass = ceed.QFunctionByName(\"MassApply\")\n",
118 "\n",
119 "q = 8\n",
120 "\n",
121 "j_array = np.zeros(q, dtype=\"float64\")\n",
122 "w_array = np.zeros(q, dtype=\"float64\")\n",
123 "u_array = np.zeros(q, dtype=\"float64\")\n",
124 "v_true = np.zeros(q, dtype=\"float64\")\n",
125 "for i in range(q):\n",
126 " x = 2.*i/(q-1) - 1\n",
127 " j_array[i] = 1\n",
128 " w_array[i] = 1 - x*x\n",
129 " u_array[i] = 2 + 3*x + 5*x*x\n",
130 " v_true[i] = w_array[i] * u_array[i]\n",
131 "\n",
132 "j = ceed.Vector(q)\n",
133 "j.set_array(j_array, cmode=libceed.USE_POINTER)\n",
134 "w = ceed.Vector(q)\n",
135 "w.set_array(w_array, cmode=libceed.USE_POINTER)\n",
136 "u = ceed.Vector(q)\n",
137 "u.set_array(u_array, cmode=libceed.USE_POINTER)\n",
138 "v = ceed.Vector(q)\n",
139 "v.set_value(0)\n",
140 "qdata = ceed.Vector(q)\n",
141 "qdata.set_value(0)\n",
142 "\n",
143 "inputs = [ j, w ]\n",
144 "outputs = [ qdata ]\n",
145 "qf_setup.apply(q, inputs, outputs)\n",
146 "\n",
147 "inputs = [ w, u ]\n",
148 "outputs = [ v ]\n",
149 "qf_mass.apply(q, inputs, outputs)\n",
150 "\n",
167 "fields = 3\n",
168 "\n",
169 "qf = ceed.IdentityQFunction(fields, libceed.EVAL_INTERP, libceed.EVAL_INTERP)\n",
170 "\n",
171 "q = 8\n",
172 "\n",
173 "u_array = np.zeros(q*fields, dtype=\"float64\")\n",
174 "for i in range(q*fields):\n",
175 " u_array[i] = i*i\n",
176 "\n",
177 "u = ceed.Vector(q*fields)\n",
178 "u.set_array(u_array, cmode=libceed.USE_POINTER)\n",
179 "v = ceed.Vector(q*fields)\n",
180 "v.set_value(0)\n",
181 "\n",
182 "inputs = [ u ]\n",
183 "outputs = [ v ]\n",
184 "qf.apply(q, inputs, outputs)\n",
185 "\n",