Skip to main content

optiSLang MOPSolver API 2026 R1

File mopsolver_api2_shared.h

Last update: 31.07.2026

Location: mopsolver_api2_shared.h

version
$Rev$

Includes

flowchart LR
  n1["mopsolver_api2_shared.h"]
  n2["mopsolver_api_shared.h"]
  n1 --> n2
  click n1 href "mopsolver__api2__shared_8h.md#mopsolver__api2__shared_8h"
  click n2 href "mopsolver__api__shared_8h.md#mopsolver__api__shared_8h"

Included by

flowchart RL
  n1["mopsolver_api2_shared.h"]
  n2["mopsolver_api2.h"]
  n3["mopsolver_api2_hash.h"]
  n2 --> n1
  n3 --> n1
  click n1 href "mopsolver__api2__shared_8h.md#mopsolver__api2__shared_8h"
  click n2 href "mopsolver__api2_8h.md#mopsolver__api2_8h"
  click n3 href "mopsolver__api2__hash_8h.md#mopsolver__api2__hash_8h"

Enumeration types

Enumeration type DMOP2_SOLVE_FLAG

Definition: mopsolver_api2_shared.h (line 13)

enum DMOP2_SOLVE_FLAG {
  SOLVE_EXTRAPOLATE = 1,
  SOLVE_RESPONSES = 2,
  SOLVE_CRITERIA = 4,
  SOLVE_DENSITIES = 8,
  SOLVE_ERRORS = 16
}

Enum containing the flags to control the behaviour of the solve method

Enumerator SOLVE_EXTRAPOLATE

if set, extrapolation is activated

Enumerator SOLVE_RESPONSES

if set, the response values are written to the output array

Enumerator SOLVE_CRITERIA

if set, the criteria values are written to the output array

Enumerator SOLVE_DENSITIES

if set, the density values are written to the output array

Enumerator SOLVE_ERRORS

if set, the error values (CoP, RMSE, error, absolute error) are written to the output array

Enumeration type DMOP2_DIMENSION_FLAG

Definition: mopsolver_api2_shared.h (line 28)

enum DMOP2_DIMENSION_FLAG {
  DIM_INPUTS = 1,
  DIM_RESPONSES = 2,
  DIM_CRITERIA = 4
}

Enum containing the flags to control the behaviour of the getDimensions method

Enumerator DIM_INPUTS

if set, the number of inputs is written to the output array

Enumerator DIM_RESPONSES

if set, the number of responses is written to the output array

Enumerator DIM_CRITERIA

if set, the number of criteria is written to the output array

Enumeration type DMOP2_NAME_FLAG

Definition: mopsolver_api2_shared.h (line 39)

enum DMOP2_NAME_FLAG {
  NAME_INPUTS = 1,
  NAME_RESPONSES = 2,
  NAME_CRITERIA = 4
}

Enum containing the flags to control the behaviour of the getNames method

Enumerator NAME_INPUTS

if set, the names of the inputs are returned

Enumerator NAME_RESPONSES

if set, the names of the outputs are returned

Enumerator NAME_CRITERIA

if set, the names of the criteria are returned

Enumeration type DMOP2_PER_RESPONSE_FLAG

Definition: mopsolver_api2_shared.h (line 50)

enum DMOP2_PER_RESPONSE_FLAG {
  RESP_EXTRAPOLATE = 1,
  RESP_GRADIENTS = 2,
  RESP_DENSITIES = 4,
  RESP_ERRORS = 8
}

Enum containing the flags to control the behaviour of the get_per_response method

Enumerator RESP_EXTRAPOLATE

if set, extrapolation is activated

Enumerator RESP_GRADIENTS

if set, the gradient values of the response are written to the output array

Enumerator RESP_DENSITIES

if set, the density value of the response is written to the output array

Enumerator RESP_ERRORS

if set, the errors of the response are written to the output array

Enumeration type DMOP2_RETURN_CODES

Definition: mopsolver_api2_shared.h (line 63)

enum DMOP2_RETURN_CODES {
  dmop2_success = 0,
  dmop2_error = 1,
  dmop2_exception_occured = 2,
  dmop2_custom_interface_not_enabled = 4,
  dmop2_wrong_input_argument = 41
}

Enum containing the return codes used by the dmop2 methods, similar to the mop_api.h codes

Enumerator dmop2_success

Enumerator dmop2_error

Enumerator dmop2_exception_occured

Enumerator dmop2_custom_interface_not_enabled

Enumerator dmop2_wrong_input_argument

Functions

Function dmop2_getLastError

DYNARDO_MOPSOLVER_API const char * dmop2_getLastError()

Calling a solver API function will reset the string, so you'll need to check for errors immediately after the function call. Returns:

String describing last error or nullptr if no error occured.

Return type: DYNARDO_MOPSOLVER_API const char *

Function dmop2_free

DYNARDO_MOPSOLVER_API int dmop2_free(void *_pointer)

Frees the memory allocated at the specified pointer Parameters:

  • _pointer: Pointer to the memory that should be freed

Returns:

zero if the memory was successfully freed

Parameters:

  • void * _pointer

Return type: DYNARDO_MOPSOLVER_API int

Function dmop2_get_version_str

DYNARDO_MOPSOLVER_API const char * dmop2_get_version_str()

Retrieves the current OptiSLang version and returns it as a string Returns:

String containing the current OptiSLang version

Return type: DYNARDO_MOPSOLVER_API const char *

Function dmop2_cleanup

DYNARDO_MOPSOLVER_API int dmop2_cleanup()

cleans-up all the memory allocated by the API, use this after you've finished using the API. Objects pointing to memory provided by this API are going to be invalidated. Returns:

zero

Return type: DYNARDO_MOPSOLVER_API int

Function dmop2_set_paths_for_custom_interface

DYNARDO_MOPSOLVER_API int dmop2_set_paths_for_custom_interface(const char *_program_path, const char *_python_home, const char *const *_python_paths, unsigned int _num_python_paths, const char *const *_script_paths, unsigned int _num_script_paths, const char *_oop_path)

set up custom interface application-wide

Parameters:

  • const char * _program_path
  • const char * _python_home
  • const char *const * _python_paths
  • unsigned int _num_python_paths
  • const char *const * _script_paths
  • unsigned int _num_script_paths
  • const char * _oop_path

Return type: DYNARDO_MOPSOLVER_API int

Source


#ifndef DYNARDO_MOPSOLVERAPI2_SHARED_H
#define DYNARDO_MOPSOLVERAPI2_SHARED_H

#include "mopsolver_api_shared.h"

enum DMOP2_SOLVE_FLAG {
    SOLVE_EXTRAPOLATE = 1,
    SOLVE_RESPONSES = 2,
    SOLVE_CRITERIA = 4,
    SOLVE_DENSITIES = 8,
    SOLVE_ERRORS = 16
};

enum DMOP2_DIMENSION_FLAG {
    DIM_INPUTS = 1,
    DIM_RESPONSES = 2,
    DIM_CRITERIA = 4
};

enum DMOP2_NAME_FLAG {
    NAME_INPUTS = 1,
    NAME_RESPONSES = 2,
    NAME_CRITERIA = 4
};

enum DMOP2_PER_RESPONSE_FLAG {
    RESP_EXTRAPOLATE = 1,
    RESP_GRADIENTS = 2,
    RESP_DENSITIES = 4,
    RESP_ERRORS = 8
};

enum DMOP2_RETURN_CODES {
    dmop2_success = 0,

    dmop2_error = 1,
    dmop2_exception_occured = 2,
    dmop2_custom_interface_not_enabled = 4,

    dmop2_wrong_input_argument = 41
};

DYNARDO_MOPSOLVER_API
const char* dmop2_getLastError();

DYNARDO_MOPSOLVER_API
int dmop2_free(void* _pointer);

DYNARDO_MOPSOLVER_API
const char* dmop2_get_version_str();

DYNARDO_MOPSOLVER_API
int dmop2_cleanup();

DYNARDO_MOPSOLVER_API
int dmop2_set_paths_for_custom_interface(const char* _program_path,
    const char* _python_home,
    const char* const* _python_paths,
    unsigned int _num_python_paths,
    const char* const* _script_paths,
    unsigned int _num_script_paths,
    const char* _oop_path);

#endif

Connect with Ansys