void evaluate(const ConstGeometricalDataSlice<CoordinateType> &testGeomData,
                const ConstGeometricalDataSlice<CoordinateType> &trialGeomData,
                CollectionOf2dSlicesOfNdArrays<ValueType> &result) const {
    const int coordCount = 3;
    const ValueType waveNumber = m_waveNumber;

    CoordinateType distanceSq = 0.;
    CoordinateType nTest_diff = 0;
    CoordinateType nTrial_diff = 0;
    CoordinateType nTest_nTrial = 0.;
    for (int coordIndex = 0; coordIndex < coordCount; ++coordIndex) {
      CoordinateType diff =
          trialGeomData.global(coordIndex) - testGeomData.global(coordIndex);
      distanceSq += diff * diff;
      nTest_diff += diff * testGeomData.normal(coordIndex);
      nTrial_diff += diff * trialGeomData.normal(coordIndex);
      nTest_nTrial +=
          testGeomData.normal(coordIndex) * trialGeomData.normal(coordIndex);
    }
    CoordinateType distance = sqrt(distanceSq);
    ValueType kr = waveNumber * distance;
    ValueType v = m_interpolator.evaluate(distance);
    const CoordinateType ONE = 1., THREE = 3.;
    result[0](0, 0) =
        static_cast<CoordinateType>(1.0 / (4.0 * M_PI)) /
        (distance * distanceSq * distanceSq) *
        (-distanceSq * nTest_nTrial * (ONE + kr) +
         nTest_diff * nTrial_diff * (THREE + THREE * kr + kr * kr)) *
        v;
  }
    void evaluate(
            const ConstGeometricalDataSlice<CoordinateType>& testGeomData,
            const ConstGeometricalDataSlice<CoordinateType>& trialGeomData,
            CollectionOf2dSlicesOfNdArrays<ValueType>& result) const {
        const int coordCount = 3;
        assert(testGeomData.dimWorld() == coordCount);
        assert(result.size() == 1);

        CoordinateType distanceSq = 0.;
        CoordinateType nTest_diff = 0;
        CoordinateType nTrial_diff = 0;
        CoordinateType nTest_nTrial = 0.;
        for (int coordIndex = 0; coordIndex < coordCount; ++coordIndex) {
            CoordinateType diff = trialGeomData.global(coordIndex) -
                    testGeomData.global(coordIndex);
            distanceSq += diff * diff;
            nTest_diff += diff * testGeomData.normal(coordIndex);
            nTrial_diff += diff * trialGeomData.normal(coordIndex);
            nTest_nTrial += testGeomData.normal(coordIndex) *
                    trialGeomData.normal(coordIndex);
        }
        CoordinateType distance = sqrt(distanceSq);
        CoordinateType commonFactor =
                static_cast<CoordinateType>(-1. / (4. * M_PI)) /
                (distance * distanceSq * distanceSq);
        result[0](0, 0) = commonFactor * (
                    nTest_nTrial * distanceSq -
                    static_cast<CoordinateType>(3.) * nTest_diff * nTrial_diff);
    }
コード例 #3
0
 void evaluate(
         const ConstBasisDataSlice<ValueType>& basisData,
         const ConstGeometricalDataSlice<CoordinateType>& geomData,
         _1dSliceOf3dArray<ValueType>& result) const {
     assert(basisData.componentCount() == 1);
     const int dimWorld = geomData.dimWorld();
     for (int dim = 0; dim < dimWorld; ++dim)
         result(dim) = basisData.values(0) * geomData.normal(dim);
 }
    void evaluate(
            const ConstGeometricalDataSlice<CoordinateType>& testGeomData,
            const ConstGeometricalDataSlice<CoordinateType>& trialGeomData,
            CollectionOf2dSlicesOfNdArrays<ValueType>& result) const {
        const int coordCount = 3;

        CoordinateType x_y = 0.;
        for (int coordIndex = 0; coordIndex < coordCount; ++coordIndex)
            x_y += testGeomData.global(coordIndex) *
                    trialGeomData.global(coordIndex);
        CoordinateType x_ny = 0.;
        for (int coordIndex = 0; coordIndex < coordCount; ++coordIndex)
            x_ny += testGeomData.global(coordIndex) *
                    trialGeomData.normal(coordIndex);
        result[0](0, 0) = static_cast<ValueType>(1.0 / (4.0 * M_PI)) *
                m_waveNumber * x_ny * exp(m_waveNumber * x_y);
    }
  void evaluate(const ConstGeometricalDataSlice<CoordinateType> &testGeomData,
                const ConstGeometricalDataSlice<CoordinateType> &trialGeomData,
                CollectionOf2dSlicesOfNdArrays<ValueType> &result) const {
    const int coordCount = 3;

    CoordinateType numeratorSum = 0., distSq = 0.;
    for (int coordIndex = 0; coordIndex < coordCount; ++coordIndex) {
      CoordinateType diff =
          trialGeomData.global(coordIndex) - testGeomData.global(coordIndex);
      distSq += diff * diff;
      numeratorSum += diff * trialGeomData.normal(coordIndex);
    }
    CoordinateType dist = sqrt(distSq);
    ValueType v = m_interpolator.evaluate(dist);
    result[0](0, 0) =
        numeratorSum /
        (static_cast<CoordinateType>(-4.0 * M_PI) * distSq * dist) *
        (m_waveNumber * dist + static_cast<CoordinateType>(1.0)) * v;
  }