1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255
|
//
// KIM-API: An API for interatomic models
// Copyright (c) 2013--2022, Regents of the University of Minnesota.
// All rights reserved.
//
// Contributors:
// Ryan S. Elliott
//
// SPDX-License-Identifier: LGPL-2.1-or-later
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this library; if not, write to the Free Software Foundation,
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
//
//
// Release: This file is part of the kim-api.git repository.
//
#ifndef KIM_COMPUTE_ARGUMENTS_HPP_
#define KIM_COMPUTE_ARGUMENTS_HPP_
#include <string>
#ifndef KIM_FUNCTION_TYPES_HPP_
#include "KIM_FunctionTypes.hpp" // IWYU pragma: export
#endif
namespace KIM
{
// Forward declarations
class LogVerbosity;
class LanguageName;
class ComputeArgumentName;
class ComputeCallbackName;
class SupportStatus;
class ComputeArgumentsImplementation;
/// \brief Provides the primary interface to a %KIM API ComputeArguments object
/// and is meant to be used by simulators.
///
/// \sa KIM_ComputeArguments,
/// kim_compute_arguments_module::kim_compute_arguments_handle_type
///
/// \since 2.0
class ComputeArguments
{
public:
/// \brief Get the SupportStatus of a ComputeArgumentName.
///
/// \param[in] computeArgumentName The ComputeArgumentName of interest.
/// \param[out] supportStatus The Model's corresponding SupportStatus.
///
/// \return \c true if \c computeArgumentName is unknown.
/// \return \c false otherwise.
///
/// \sa KIM_ComputeArguments_GetArgumentSupportStatus,
/// kim_compute_arguments_module::kim_get_argument_support_status
///
/// \since 2.0
int GetArgumentSupportStatus(ComputeArgumentName const computeArgumentName,
SupportStatus * const supportStatus) const;
/// \brief Get the SupportStatus of a ComputeCallbackName.
///
/// \param[in] computeCallbackName The ComputeCallbackName of interest.
/// \param[out] supportStatus The Model's corresponding SupportStatus.
///
/// \return \c true if \c computeCallbackName is unknown.
/// \return \c false otherwise.
///
/// \sa KIM_ComputeArguments_GetCallbackSupportStatus,
/// kim_compute_arguments_module::kim_get_callback_support_status
///
/// \since 2.0
int GetCallbackSupportStatus(ComputeCallbackName const computeCallbackName,
SupportStatus * const supportStatus) const;
/// \brief Set the data pointer for a ComputeArgumentName.
///
/// \todo Add more detailed description what it means to provide a NULL or
/// non-NULL value for various SupportStatus'es.
///
/// \param[in] computeArgumentName The ComputeArgumentName of interest.
/// \param[in] ptr The data pointer.
///
/// \return \c true if \c computeArgumentName is unknown.
/// \return \c true if `ptr != NULL` and `computeArgumentName ==
/// SUPPORT_STATUS::notSupported`.
/// \return \c false otherwise.
///
/// \sa KIM_ComputeArguments_SetArgumentPointerInteger,
/// KIM_ComputeArguments_SetArgumentPointerDouble,
/// kim_compute_arguments_module::kim_set_argument_pointer
///
/// \since 2.0
int SetArgumentPointer(ComputeArgumentName const computeArgumentName,
int const * const ptr);
/// \overload
int SetArgumentPointer(ComputeArgumentName const computeArgumentName,
int * const ptr);
/// \overload
int SetArgumentPointer(ComputeArgumentName const computeArgumentName,
double const * const ptr);
/// \overload
int SetArgumentPointer(ComputeArgumentName const computeArgumentName,
double * const ptr);
/// \brief Set the function pointer for a ComputeCallbackName.
///
/// \todo Add more detailed description what it means to provide a NULL or
/// non-NULL value for various SupportStatus'es. Also, describe dataObject.
///
/// \param[in] computeCallbackName The ComputeCallbackName of interest.
/// \param[in] languageName The LanguageName of the callback.
/// \param[in] fptr The function pointer.
/// \param[in] dataObject The data pointer associated with the callback.
///
/// \return \c true if \c computeCallbackName is unknown.
/// \return \c true if `fptr != NULL` and `computeCallbackName ==
/// SUPPORT_STATUS::notSupported`.
/// \return \c false otherwise.
///
/// \sa KIM_ComputeArguments_SetCallbackPointer,
/// kim_compute_arguments_module::kim_set_callback_pointer
///
/// \since 2.0
int SetCallbackPointer(ComputeCallbackName const computeCallbackName,
LanguageName const languageName,
Function * const fptr,
void * const dataObject);
/// \brief Determine if non-NULL pointers have been set for all
/// ComputeArgumentName's and ComputeCallbackName's with SupportStatus
/// values of SUPPORT_STATUS::requiredByAPI or SUPPORT_STATUS::required.
///
/// \param[out] result Is \c true if all such arguments and callbacks have
/// non-NULL pointers, and is \c false otherwise.
///
/// \sa KIM_ComputeArguments_AreAllRequiredArgumentsAndCallbacksPresent,
/// kim_compute_arguments_module::kim_are_all_required_present
///
/// \since 2.0
void AreAllRequiredArgumentsAndCallbacksPresent(int * const result) const;
/// \brief Set the \ref cache_buffer_pointers "Simulator's buffer pointer"
/// within the ComputeArguments object.
///
/// The simulator buffer pointer may be used by the simulator to associate
/// a memory buffer with the ComputeArguments object.
///
/// \param[in] ptr The simulator buffer data pointer.
///
/// \sa KIM_ComputeArguments_SetSimulatorBufferPointer,
/// kim_compute_arguments_module::kim_set_simulator_buffer_pointer
///
/// \since 2.0
void SetSimulatorBufferPointer(void * const ptr);
/// \brief Get the \ref cache_buffer_pointers "Simulator's buffer pointer"
/// from the ComputeArguments object.
///
/// \param[out] ptr The simulator buffer data pointer.
///
/// \note `ptr == NULL` if the simulator has not previously called
/// ComputeArguments::SetSimulatorBufferPointer.
///
/// \sa KIM_ComputeArguments_GetSimulatorBufferPointer,
/// kim_compute_arguments_module::kim_get_simulator_buffer_pointer
///
/// \since 2.0
void GetSimulatorBufferPointer(void ** const ptr) const;
/// \brief Get a string representing the internal state of the
/// ComputeArguments object.
///
/// This string is primarily meant for use as a debugging tool. The string
/// may be quite long. It begins and ends with lines consisting only of \c
/// ='s.
///
/// \sa KIM_ComputeArguments_ToString,
/// kim_compute_arguments_module::kim_to_string
///
/// \since 2.0
std::string const & ToString() const;
/// \brief Set the identity of the Log object associated with the
/// ComputeArguments object.
///
/// \param[in] logID String identifying the ComputeArguments object's Log
/// object.
///
/// \sa KIM_ComputeArguments_SetLogID,
/// kim_compute_arguments_module::kim_set_log_id
///
/// \since 2.0
void SetLogID(std::string const & logID);
/// \brief Push a new LogVerbosity onto the ComputeArguments object's Log
/// object verbosity stack.
///
/// \param[in] logVerbosity A LogVerbosity value.
///
/// \sa KIM_ComputeArguments_PushLogVerbosity,
/// kim_compute_arguments_module::kim_push_log_verbosity
///
/// \since 2.0
void PushLogVerbosity(LogVerbosity const logVerbosity);
/// \brief Pop a LogVerbosity from the ComputeArguments object's Log object
/// verbosity stack.
///
/// \sa KIM_ComputeArguments_PopLogVerbosity,
/// kim_compute_arguments_module::kim_pop_log_verbosity
///
/// \since 2.0
void PopLogVerbosity();
/// \brief Allows Model objects to directly access private member data of a
/// ComputeArguments object.
///
/// \note This has no practical effect on \e users of the %KIM API.
///
/// \since 2.0
friend class ModelImplementation;
private:
// do not allow copy constructor or operator=
ComputeArguments(ComputeArguments const &);
void operator=(ComputeArguments const &);
ComputeArguments();
~ComputeArguments();
ComputeArgumentsImplementation * pimpl;
}; // class ComputeArguments
} // namespace KIM
#endif // KIM_COMPUTE_ARGUMENTS_HPP_
|