92 const unsigned int component)
const
96 "FunctionDerivative was not initialized for constant direction"));
101 return (f.value(p + incr[0], component) -
102 f.value(p - incr[0], component)) /
105 return (f.value(p, component) - f.value(p - incr[0], component)) / h;
107 return (-f.value(p + 2 * incr[0], component) +
108 8 * f.value(p + incr[0], component) -
109 8 * f.value(p - incr[0], component) +
110 f.value(p - 2 * incr[0], component)) /
127 "FunctionDerivative was not initialized for constant direction"));
137 f.vector_value(p - incr[0], aux);
138 result.
sadd(1. / (2 * h), -1. / (2 * h), aux);
142 f.vector_value(p - incr[0], aux);
143 result.
sadd(1. / h, -1. / h, aux);
147 f.vector_value(p + 2 * incr[0], aux);
148 result.
add(-1., aux);
149 f.vector_value(p - incr[0], aux);
150 result.
add(-8., aux);
151 f.vector_value(p + incr[0], aux);
165 std::vector<double> &values,
166 const unsigned int component)
const
168 const unsigned int n = points.size();
169 const bool variable_direction = (incr.size() == 1) ?
false :
true;
170 if (variable_direction)
171 Assert(incr.size() == points.size(),
175 std::vector<double> aux(n);
177 std::vector<Point<dim>> paux(n);
184 for (
unsigned int i = 0; i < n; ++i)
185 paux[i] = points[i] + incr[(variable_direction) ? i : 0U];
186 f.value_list(paux, values, component);
187 for (
unsigned int i = 0; i < n; ++i)
188 paux[i] = points[i] - incr[(variable_direction) ? i : 0U];
189 f.value_list(paux, aux, component);
190 for (
unsigned int i = 0; i < n; ++i)
191 values[i] = (values[i] - aux[i]) / (2 * h);
195 for (
unsigned int i = 0; i < n; ++i)
196 paux[i] = points[i] - incr[(variable_direction) ? i : 0U];
197 f.value_list(paux, aux, component);
198 for (
unsigned int i = 0; i < n; ++i)
199 values[i] = (values[i] - aux[i]) / h;
202 for (
unsigned int i = 0; i < n; ++i)
203 paux[i] = points[i] - 2 * incr[(variable_direction) ? i : 0U];
204 f.value_list(paux, values, component);
205 for (
unsigned int i = 0; i < n; ++i)
206 paux[i] = points[i] + 2 * incr[(variable_direction) ? i : 0U];
207 f.value_list(paux, aux, component);
208 for (
unsigned int i = 0; i < n; ++i)
210 for (
unsigned int i = 0; i < n; ++i)
211 paux[i] = points[i] + incr[(variable_direction) ? i : 0U];
212 f.value_list(paux, aux, component);
213 for (
unsigned int i = 0; i < n; ++i)
214 values[i] += 8. * aux[i];
215 for (
unsigned int i = 0; i < n; ++i)
216 paux[i] = points[i] - incr[(variable_direction) ? i : 0U];
217 f.value_list(paux, aux, component);
218 for (
unsigned int i = 0; i < n; ++i)
219 values[i] = (values[i] - 8. * aux[i]) / (12 * h);