FiberVISH 0.2
Fish - The Fiber Bundle API for the Vish Visualization Shell
PartialDerivative.hpp
1#ifndef __FIBER_VECTOR_PARTIAL_DERIVATIVE_HPP
2#define __FIBER_VECTOR_PARTIAL_DERIVATIVE_HPP
3
4#include <eagle/Vector.hpp>
5#include "MultiArray.hpp"
6
7namespace Fiber
8{
9
10
16template <int IndexChart, typename Value, typename ResultType>
19{
20
21const MultiIndex<IndexChart>&Sz = ValueField.Size();
22
23 for(int i=0; i<IndexChart; i++)
24 {
26
27 if (I[i]<1) // on left boundary, need to do forward-differencing
28 {
29 result[i] = ValueField[ I + DiffI ] - ValueField[ I ];
30 }
31 else if (I[i]>=Sz[i]-1) // on right boundary, need to do backward-differencing
32 {
33 result[i] = ValueField[ I ] - ValueField[ I - DiffI ];
34 }
35 else
36 {
37 result[i] = 0.5*(ValueField[ I + DiffI ] - ValueField[ I - DiffI ]);
38 }
39 }
40
41 return result;
42}
43
44
45} /* namespace Fiber */
46
47#endif /* __FIBER_VECTOR_PARTIAL_DERIVATIVE_HPP */
48
An iterator with an optional DataCreator, which is just a class to intercept creation of data along a...
Definition CreativeIterator.hpp:34
static MultiIndex Axis(unsigned int orientation) noexcept
Return a MultiIndex that points just in the given orientation.
Definition MultiIndex.hpp:469
Given a fragmented field of curvilinear coordinates, (3D array of coordinates), build a uniform Grid ...
Definition FAQ.dox:2