Exemple #1
0
 /**
  * Integrate down the centre of this unknown
  * This will not take into account changes
  * in the jacobian across the extent of the basis
  * function
  */
 static
 typename UnknownT::NumberT
 integrate(
     const UnknownT& unknown,
     const CoordinatesInterface<DIM,
         typename UnknownT::NumberT>& geom,
     const int direction)
 {
     GaussLegendre<UnknownT::ORDER, NumberT> quad;
     ValueT integral(0.0);
     for (auto interval1D :
          unknown.linearIntervals1D(direction)) {
         NumberT intervalMin = interval1D.minimum(0);
         NumberT intervalMax = interval1D.maximum(0);
         auto nodes = quad.nodes(intervalMin, intervalMax);
         auto weights = quad.weights(intervalMin, intervalMax);
         auto location = unknown.centres();
         for (std::size_t j = 0; j < nodes.size(); ++j) {
             location[direction] = nodes[j];
             integral += weights[j] *
                     unknown.value(direction, nodes[j]) *
                     geom.jacobian(direction, nodes[j]);
         }
     }
     return integral;
 }
Exemple #2
0
 static
 std::array<std::array<T, ORDER+1>, DIM>
 nodes(const GaussLegendre<ORDER, T>& quad,
       const Vector<DIM, T>& mins,
       const Vector<DIM, T>& maxs)
 {
     std::array<std::array<T, ORDER+1>, DIM> allNodes;
     for (uint i = 0; i < DIM; ++i) {
         assert(maxs[i] > mins[i]);
         allNodes[i] = quad.nodes(mins[i], maxs[i]);
     }
     return allNodes;
 }