48 for (
unsigned int i = 0; i <
incr.size(); ++i)
70 ExcMessage(
"The argument passed to this function does not "
71 "match any known difference formula."));
83 for (
unsigned int i = 0; i < incr.size(); ++i)
93 const unsigned int component)
const
97 "FunctionDerivative was not initialized for constant direction"));
102 return (f.value(p + incr[0], component) -
103 f.value(p - incr[0], component)) /
106 return (f.value(p, component) - f.value(p - incr[0], component)) / h;
108 return (-f.value(p + 2 * incr[0], component) +
109 8 * f.value(p + incr[0], component) -
110 8 * f.value(p - incr[0], component) +
111 f.value(p - 2 * incr[0], component)) /
128 "FunctionDerivative was not initialized for constant direction"));
138 f.vector_value(p - incr[0], aux);
139 result.
sadd(1. / (2 * h), -1. / (2 * h), aux);
143 f.vector_value(p - incr[0], aux);
144 result.
sadd(1. / h, -1. / h, aux);
148 f.vector_value(p + 2 * incr[0], aux);
149 result.
add(-1., aux);
150 f.vector_value(p - incr[0], aux);
151 result.
add(-8., aux);
152 f.vector_value(p + incr[0], aux);
166 std::vector<double> & values,
167 const unsigned int component)
const
169 const unsigned int n = points.size();
170 const bool variable_direction = (incr.size() == 1) ?
false :
true;
171 if (variable_direction)
172 Assert(incr.size() == points.size(),
176 std::vector<double> aux(n);
178 std::vector<Point<dim>> paux(n);
185 for (
unsigned int i = 0; i < n; ++i)
186 paux[i] = points[i] + incr[(variable_direction) ? i : 0
U];
187 f.value_list(paux, values, component);
188 for (
unsigned int i = 0; i < n; ++i)
189 paux[i] = points[i] - incr[(variable_direction) ? i : 0
U];
190 f.value_list(paux, aux, component);
191 for (
unsigned int i = 0; i < n; ++i)
192 values[i] = (values[i] - aux[i]) / (2 * h);
196 for (
unsigned int i = 0; i < n; ++i)
197 paux[i] = points[i] - incr[(variable_direction) ? i : 0
U];
198 f.value_list(paux, aux, component);
199 for (
unsigned int i = 0; i < n; ++i)
200 values[i] = (values[i] - aux[i]) / h;
203 for (
unsigned int i = 0; i < n; ++i)
204 paux[i] = points[i] - 2 * incr[(variable_direction) ? i : 0
U];
205 f.value_list(paux, values, component);
206 for (
unsigned int i = 0; i < n; ++i)
207 paux[i] = points[i] + 2 * incr[(variable_direction) ? i : 0
U];
208 f.value_list(paux, aux, component);
209 for (
unsigned int i = 0; i < n; ++i)
211 for (
unsigned int i = 0; i < n; ++i)
212 paux[i] = points[i] + incr[(variable_direction) ? i : 0
U];
213 f.value_list(paux, aux, component);
214 for (
unsigned int i = 0; i < n; ++i)
215 values[i] += 8. * aux[i];
216 for (
unsigned int i = 0; i < n; ++i)
217 paux[i] = points[i] - incr[(variable_direction) ? i : 0
U];
218 f.value_list(paux, aux, component);
219 for (
unsigned int i = 0; i < n; ++i)
220 values[i] = (values[i] - 8. * aux[i]) / (12 * h);
235 return sizeof(*this);