Ejemplo n.º 1
0
/**
 * compute the near-field component of the field
 */
FCSResult fcs_compute_near_field(FCS handle, fcs_float dist, fcs_float *field)
{
  switch (fcs_get_method(handle))
  {
#ifdef FCS_ENABLE_P2NFFT
    case FCS_METHOD_P2NFFT:
      *field = fcs_p2nfft_compute_near_field(handle, dist);
      return FCS_RESULT_SUCCESS;
#endif
#ifdef FCS_ENABLE_P3M
    case FCS_METHOD_P3M:
      {
        fcs_p3m_near_parameters_t params;
        fcs_p3m_get_near_parameters(handle, &params);
        *field = fcs_p3m_compute_near_field(params, dist);
      }
      return FCS_RESULT_SUCCESS;
#endif
  }

  return fcs_result_create(FCS_ERROR_NOT_IMPLEMENTED, __func__, "Computing the near-field component of the field not implemented for solver method '%s'", fcs_get_method_name(handle));
}
Ejemplo n.º 2
0
/**
 * compute the near-field component of the potential
 */
FCSResult fcs_compute_near_potential(FCS handle, fcs_float dist, fcs_float *potential)
{
  const char *fnc_name = "fcs_compute_near_potential";

  switch (fcs_get_method(handle))
  {
#ifdef FCS_ENABLE_P2NFFT
    case FCS_METHOD_P2NFFT:
      *potential = fcs_p2nfft_compute_near_potential(handle, dist);
      return FCS_RESULT_SUCCESS;
#endif
#ifdef FCS_ENABLE_P3M
    case FCS_METHOD_P3M:
      {
        fcs_p3m_near_parameters_t params;
        fcs_p3m_get_near_parameters(handle, &params);
        *potential = fcs_p3m_compute_near_potential(params, dist);
      }
      return FCS_RESULT_SUCCESS;
#endif
  }

  return fcs_result_create(FCS_ERROR_NOT_IMPLEMENTED, fnc_name, "Computing the near-field component of the potential not implemented for solver method '%s'", fcs_get_method_name(handle));
}