Exemple #1
0
inline _4dArray<T> &_4dArray<T>::operator=(const _4dArray &rhs) {
  if (&rhs != this) {
    set_size(rhs.m_extents[0], rhs.m_extents[1], rhs.m_extents[2],
             rhs.m_extents[3]);
    std::copy(rhs.begin(), rhs.end(), m_storage);
  }
  return *this;
}
Exemple #2
0
inline _4dArray<T> &_4dArray<T>::operator+=(const _4dArray<T> &other) {
  if ((this->extent(0) != other.extent(0)) ||
      (this->extent(1) != other.extent(1)) ||
      (this->extent(2) != other.extent(2)) ||
      (this->extent(3) != other.extent(3)))
    std::runtime_error("_4dArray<T> operator+=: Array sizes don't agree.");
  for (size_t i = 0; i < this->extent(3); ++i)
    for (size_t j = 0; j < this->extent(2); ++j)
      for (size_t k = 0; k < this->extent(1); ++k)
        for (size_t l = 0; l < this->extent(0); ++l)
          (*this)(l, k, j, i) += other(l, k, j, i);
  return *this;
}
Exemple #3
0
void evaluateShapeFunctionDerivativesWithDune(
    const arma::Mat<CoordinateType> &local, LocalDofIndex localDofIndex,
    _4dArray<ValueType> &result, const DuneBasis &basis = DuneBasis()) {
  typedef typename DuneBasis::Traits Traits;
  assert(local.n_rows == Traits::dimDomain);
  assert(localDofIndex == ALL_DOFS ||
         (localDofIndex >= 0 && localDofIndex < basis.size()));

  const int functionCount = localDofIndex == ALL_DOFS ? basis.size() : 1;
  const int pointCount = local.n_cols;

  typename Traits::DomainType point;
  std::vector<typename Traits::JacobianType> jacobians;
  result.set_size(Traits::dimRange, Traits::dimDomain, functionCount,
                  pointCount);

  for (int pointIndex = 0; pointIndex < pointCount; ++pointIndex) {
    for (int dim = 0; dim < Traits::dimDomain; ++dim)
      point[dim] = local(dim, pointIndex);
    basis.evaluateJacobian(point, jacobians);
    if (localDofIndex == ALL_DOFS)
      for (int functionIndex = 0; functionIndex < functionCount;
           ++functionIndex)
        for (int dimD = 0; dimD < Traits::dimDomain; ++dimD)
          for (int dimR = 0; dimR < Traits::dimRange; ++dimR)
            result(dimR, dimD, functionIndex, pointIndex) =
                jacobians[functionIndex][dimR][dimD];
    else
      for (int dimD = 0; dimD < Traits::dimDomain; ++dimD)
        for (int dimR = 0; dimR < Traits::dimRange; ++dimR)
          result(dimR, dimD, 0, pointIndex) =
              jacobians[localDofIndex][dimR][dimD];
  }
}
Exemple #4
0
template <typename T> inline _4dArray<T>::_4dArray(const _4dArray &other) {
  init_memory(other.m_extents[0], other.m_extents[1], other.m_extents[2],
              other.m_extents[3]);
  std::copy(other.begin(), other.end(), m_storage);
}
Exemple #5
0
 /** \brief Return number of points at which the shape functions have been
  *  calculated. */
 int pointCount() const {
     return std::max<int>(values.extent(2), derivatives.extent(3));
 }
Exemple #6
0
 /** \brief Return number of shape functions. */
 int functionCount() const {
     return std::max<int>(values.extent(1), derivatives.extent(2));
 }
Exemple #7
0
 /** \brief Return number of components of shape functions. */
 int componentCount() const {
     return std::max<int>(values.extent(0), derivatives.extent(0));
 }