本文整理汇总了C++中FCS类的典型用法代码示例。如果您正苦于以下问题:C++ FCS类的具体用法?C++ FCS怎么用?C++ FCS使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FCS类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fcs_run
/**
* run the solver method
*/
FCSResult fcs_run(FCS handle, fcs_int local_particles,
fcs_float *positions, fcs_float *charges, fcs_float *field, fcs_float *potentials)
{
const char *fnc_name = "fcs_run";
FCSResult result;
CHECK_HANDLE_RETURN_RESULT(handle, fnc_name);
if (local_particles < 0)
return fcs_result_create(FCS_ERROR_WRONG_ARGUMENT, fnc_name, "number of local particles must be non negative");
if (fcs_get_values_changed(handle))
{
result = fcs_tune(handle, local_particles, positions, charges);
if (result != FCS_RESULT_SUCCESS) return result;
}
if (!fcs_init_check(handle) || !fcs_run_check(handle))
return fcs_result_create(FCS_ERROR_MISSING_ELEMENT, fnc_name, "not all needed data has been inserted into the given handle");
if (handle->run == NULL)
return fcs_result_create(FCS_ERROR_NOT_IMPLEMENTED, fnc_name, "Running solver method '%s' not implemented", fcs_get_method_name(handle));
return handle->run(handle, local_particles, positions, charges, field, potentials);
}
示例2: fcs_print_parameters
/**
* print the parameters of an FCS solver to stdout
*/
FCSResult fcs_print_parameters(FCS handle)
{
const char *fnc_name = "fcs_print_parameters";
FCSResult result;
CHECK_HANDLE_RETURN_RESULT(handle, fnc_name);
printf("chosen method: %s\n", fcs_get_method_name(handle));
printf("near field computations done by solver: %c\n", (fcs_get_near_field_flag(handle)?'T':'F'));
printf("box vectors: [%10.4" FCS_LMOD_FLOAT "f %10.4" FCS_LMOD_FLOAT "f %10.4" FCS_LMOD_FLOAT "f], [%10.4" FCS_LMOD_FLOAT "f %10.4" FCS_LMOD_FLOAT "f %10.4" FCS_LMOD_FLOAT "f], [%10.4" FCS_LMOD_FLOAT "f %10.4" FCS_LMOD_FLOAT "f %10.4" FCS_LMOD_FLOAT "f]\n",
fcs_get_box_a(handle)[0], fcs_get_box_a(handle)[1], fcs_get_box_a(handle)[2],
fcs_get_box_b(handle)[0], fcs_get_box_b(handle)[1], fcs_get_box_b(handle)[2],
fcs_get_box_c(handle)[0], fcs_get_box_c(handle)[1], fcs_get_box_c(handle)[2]);
printf("box origin: [%10.4" FCS_LMOD_FLOAT "f %10.4" FCS_LMOD_FLOAT "f %10.4" FCS_LMOD_FLOAT "f]\n",
fcs_get_box_origin(handle)[0], fcs_get_box_origin(handle)[1], fcs_get_box_origin(handle)[2]);
printf("periodicity: %c %c %c\n", ((fcs_get_periodicity(handle)[0] == 1)?'T':'F'), ((fcs_get_periodicity(handle)[1] == 1)?'T':'F'),((fcs_get_periodicity(handle)[2] == 1)?'T':'F'));
printf("total particles: %" FCS_LMOD_INT "d\n", fcs_get_total_particles(handle));
printf("solver specific data:\n");
if (handle->print_parameters)
{
result = handle->print_parameters(handle);
if (result != FCS_RESULT_SUCCESS) fcs_result_print_result(result);
}
result = fcs_common_print_parameters(handle);
if (result != FCS_RESULT_SUCCESS) fcs_result_print_result(result);
return FCS_RESULT_SUCCESS;
}
示例3: fcs_get_r_cut
/**
* return the user-defined cutoff radius for the near-field
*/
FCSResult fcs_get_r_cut(FCS handle, fcs_float *r_cut)
{
CHECK_HANDLE_RETURN_RESULT(handle, __func__);
if (handle->get_r_cut == NULL)
return fcs_result_create(FCS_ERROR_NOT_IMPLEMENTED, __func__, "Returning a user-defined cutoff radius for the near-field not implemented for solver method '%s'", fcs_get_method_name(handle));
return handle->get_r_cut(handle, r_cut);
}
示例4: fcs_set_tolerance
/**
* set the error tolerance of the FCS solver
*/
FCSResult fcs_set_tolerance(FCS handle, fcs_int tolerance_type, fcs_float tolerance)
{
CHECK_HANDLE_RETURN_RESULT(handle, __func__);
if (handle->set_tolerance == NULL)
return fcs_result_create(FCS_ERROR_NOT_IMPLEMENTED, __func__, "Setting tolerance not implemented for solver method '%s'", fcs_get_method_name(handle));
return handle->set_tolerance(handle, tolerance_type, tolerance);
}
示例5: fcs_resort_bytes
/**
* sort additional byte particle data
*/
FCSResult fcs_resort_bytes(FCS handle, void *src, void *dst, fcs_int n)
{
CHECK_HANDLE_RETURN_RESULT(handle, __func__);
if (handle->resort_bytes == NULL)
return fcs_result_create(FCS_ERROR_INCOMPATIBLE_METHOD, __func__, "resorting not supported");
return handle->resort_bytes(handle, src, dst, n, fcs_get_communicator(handle));
}
示例6: fcs_get_resort_particles
/**
* return the new local number of particles
*/
FCSResult fcs_get_resort_particles(FCS handle, fcs_int *resort_particles)
{
CHECK_HANDLE_RETURN_RESULT(handle, __func__);
if (handle->get_resort_particles == NULL)
return fcs_result_create(FCS_ERROR_INCOMPATIBLE_METHOD, __func__, "resorting not supported");
return handle->get_resort_particles(handle, resort_particles);
}
示例7: fcs_set_resort
/**
* set whether resort support is requested
*/
FCSResult fcs_set_resort(FCS handle, fcs_int resort)
{
CHECK_HANDLE_RETURN_RESULT(handle, __func__);
if (handle->set_resort == NULL)
return fcs_result_create(FCS_ERROR_INCOMPATIBLE_METHOD, __func__, "resorting not supported");
return handle->set_resort(handle, resort);
}
示例8: fcs_resort_floats
/**
* sort additional float particle data
*/
FCSResult fcs_resort_floats(FCS handle, fcs_float *src, fcs_float *dst, fcs_int n)
{
const char* fnc_name = "fcs_resort_floats";
CHECK_HANDLE_RETURN_RESULT(handle, fnc_name);
if (handle->resort_floats == NULL)
return fcs_result_create(FCS_ERROR_INCOMPATIBLE_METHOD, fnc_name, "resorting not supported");
return handle->resort_floats(handle, src, dst, n, fcs_get_communicator(handle));
}
示例9: fcs_set_resort
/**
* set whether resort support is requested
*/
FCSResult fcs_set_resort(FCS handle, fcs_int resort)
{
const char *fnc_name = "fcs_set_resort";
CHECK_HANDLE_RETURN_RESULT(handle, fnc_name);
if (handle->set_resort == NULL)
return fcs_result_create(FCS_ERROR_INCOMPATIBLE_METHOD, fnc_name, "resorting not supported");
return handle->set_resort(handle, resort);
}
示例10: fcs_unset_r_cut
/**
* disable a user-defined cutoff radius for the near-field
*/
FCSResult fcs_unset_r_cut(FCS handle)
{
const char *fnc_name = "fcs_unset_r_cut";
CHECK_HANDLE_RETURN_RESULT(handle, fnc_name);
if (handle->unset_r_cut == NULL)
return fcs_result_create(FCS_ERROR_NOT_IMPLEMENTED, fnc_name, "Disabling a user-defined cutoff radius for the near-field not implemented for solver method '%s'", fcs_get_method_name(handle));
return handle->unset_r_cut(handle);
}
示例11: fcs_get_resort_availability
/**
* return whether resort support is available
*/
FCSResult fcs_get_resort_availability(FCS handle, fcs_int *availability)
{
CHECK_HANDLE_RETURN_RESULT(handle, __func__);
*availability = 0;
if (handle->get_resort_availability == NULL)
return fcs_result_create(FCS_ERROR_INCOMPATIBLE_METHOD, __func__, "resorting not supported");
return handle->get_resort_availability(handle, availability);
}
示例12: fcs_set_max_particle_move
/**
* set the maximum distance the particles have moved since the call of ::fcs_run
*/
FCSResult fcs_set_max_particle_move(FCS handle, fcs_float max_particle_move)
{
CHECK_HANDLE_RETURN_RESULT(handle, __func__);
/* if (handle->set_max_particle_move == NULL)
return fcs_result_create(FCS_ERROR_INCOMPATIBLE_METHOD, __func__, "max. particle move not supported");*/
if (handle->set_max_particle_move == NULL) return FCS_RESULT_SUCCESS;
return handle->set_max_particle_move(handle, max_particle_move);
}
示例13: fcs_get_resort_particles
/**
* return the new local number of particles
*/
FCSResult fcs_get_resort_particles(FCS handle, fcs_int *resort_particles)
{
const char *fnc_name = "fcs_get_resort_particles";
CHECK_HANDLE_RETURN_RESULT(handle, fnc_name);
if (handle->get_resort_particles == NULL)
return fcs_result_create(FCS_ERROR_INCOMPATIBLE_METHOD, fnc_name, "resorting not supported");
return handle->get_resort_particles(handle, resort_particles);
}
示例14: fcs_get_virial
/**
* return the comuputed virial
*/
FCSResult fcs_get_virial(FCS handle, fcs_float *virial)
{
CHECK_HANDLE_RETURN_RESULT(handle, __func__);
if (virial == NULL)
return fcs_result_create(FCS_ERROR_NULL_ARGUMENT, __func__, "null pointer supplied as argument");
if (handle->get_virial == NULL)
return fcs_result_create(FCS_ERROR_NOT_IMPLEMENTED, __func__, "Returning the computed virial not implemented for solver method '%s'", fcs_get_method_name(handle));
return handle->get_virial(handle, virial);
}
示例15: fcs_get_tolerance
/**
* return the error tolerance of the FCS solver
*/
FCSResult fcs_get_tolerance(FCS handle, fcs_int *tolerance_type, fcs_float *tolerance)
{
CHECK_HANDLE_RETURN_RESULT(handle, __func__);
*tolerance_type = FCS_TOLERANCE_TYPE_UNDEFINED;
*tolerance = -1.0;
if (handle->get_tolerance == NULL)
return fcs_result_create(FCS_ERROR_NOT_IMPLEMENTED, __func__, "Return tolerance not implemented for solver method '%s'", fcs_get_method_name(handle));
return handle->get_tolerance(handle, tolerance_type, tolerance);
}