Commit 8b1895df authored by Olivier Lantsoght's avatar Olivier Lantsoght 🏁
Browse files

[MBsysPy] Pep8.

parent 3ed1cd35
# -*- coding: utf-8 -*-
"""
-------------------------------
(c) Universite catholique de Louvain, 2019
"""Definition of CFUNCTYPE needed for callback functions."""
# (c) Universite catholique de Louvain, 2019
Creation : 2019 by O. Lantsoght
Last update : 2019
version MBsysC v1.11.2
-------------------------------
Portable Python interface to MBsysC using Ctypes.
Definition of CFUNCTYPE needed for callback functions.
"""
import ctypes
......@@ -28,15 +16,15 @@ from .forward_decl import MbsInfos_c
from .forward_decl import MbsSensor_c
#==============================================================================
# =============================================================================
# Global parameter of the current module
#==============================================================================
# =============================================================================
__DEBUG__ = False
#==============================================================================
# =============================================================================
# Declaration of function to be linked with the libraries
#==============================================================================
# =============================================================================
# User
user_JointForces_wrap = ctypes.CFUNCTYPE(None, ctypes.POINTER(MbsData_c), ctypes.c_double)
user_load_post_wrap = ctypes.CFUNCTYPE(None, ctypes.POINTER(MbsData_c))
......@@ -63,7 +51,7 @@ mbs_new_user_model_wrap = ctypes.CFUNCTYPE(ctypes.POINTER(UserModel_c))
mbs_delete_user_model_wrap = ctypes.CFUNCTYPE(None, ctypes.POINTER(UserModel_c))
mbs_delete_user_IO_wrap = ctypes.CFUNCTYPE(None, ctypes.POINTER(UserIO_c))
mbs_get_user_IO_size_wrap = ctypes.CFUNCTYPE(None, ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int))
mbs_load_user_model_xml_wrap= ctypes.CFUNCTYPE(None, ctypes.POINTER(MbsInfos_c), ctypes.POINTER(UserModel_c))
mbs_load_user_model_xml_wrap = ctypes.CFUNCTYPE(None, ctypes.POINTER(MbsInfos_c), ctypes.POINTER(UserModel_c))
mbs_bind_user_model_wrap = ctypes.CFUNCTYPE(None, ctypes.POINTER(MbsInfos_c), ctypes.POINTER(UserModel_c))
mbs_print_user_model_wrap = ctypes.CFUNCTYPE(None, ctypes.POINTER(UserModel_c))
mbs_get_user_model_size_wrap = ctypes.CFUNCTYPE(None, ctypes.POINTER(ctypes.c_int))
......
# -*- coding: utf-8 -*-
"""
-------------------------------
(c) Universite catholique de Louvain, 2019
Creation : 2019 by O. Lantsoght
Last update : 2019
version MBsysC v1.11.2
-------------------------------
Portable Python interface to MBsysC using Ctypes.
Forward declaration of all required MBsysC structure.
"""
"""Forward declaration of all required MBsysC structure."""
# (c) Universite catholique de Louvain, 2019
import ctypes
#==============================================================================
# =============================================================================
# Global parameter of the current module
#==============================================================================
# =============================================================================
__DEBUG__ = False
#==============================================================================
# =============================================================================
# forward declaration of structures (C) as class
#==============================================================================
# =============================================================================
class MbsInfos_c(ctypes.Structure):
pass
class MbsInfoBase_c(ctypes.Structure):
......
# -*- coding: utf-8 -*-
"""
-------------------------------
(c) Universite catholique de Louvain, 2019
Creation : 2019 by O. Lantsoght
Last update : 2019
version MBsysC v1.11.2
-------------------------------
Portable Python interface to MBsysC using Ctypes.
While generating the libraries:
- SENSORKIN MUST BE UNDEFINED
- REALTIME MUST BE UNDEFINED
- PRJ_FCT_PTR MUST BE DEFINED
Declaration of MBsysC structure related to mbs_data.h header file in MBsysC.
"""
"""Declaration of MBsysC structure related to mbs_data.h header file in MBsysC."""
# (c) Universite catholique de Louvain, 2019
import ctypes
......@@ -73,10 +54,10 @@ from .callback import mbs_sensor_wrap
from .callback import mbs_gensensor_wrap
#==============================================================================
# =============================================================================
# user_c
#==============================================================================
user_c._fields_ =[# REAL_TIME cannot be defined
# =============================================================================
user_c._fields_ = [
("user_JointForces", user_JointForces_wrap),
# user load
("user_load_post", user_load_post_wrap),
......@@ -111,10 +92,10 @@ user_c._fields_ =[# REAL_TIME cannot be defined
]
#==============================================================================
# =============================================================================
# symb_c
#==============================================================================
symb_c._fields_ =[# REAL_TIME cannot be defined
# =============================================================================
symb_c._fields_ = [
("mbs_link", mbs_link_wrap),
("mbs_link3D", mbs_link3D_wrap),
("mbs_extforces", mbs_extforces_wrap),
......@@ -124,31 +105,33 @@ symb_c._fields_ =[# REAL_TIME cannot be defined
("mbs_cons_hJ", mbs_cons_hJ_wrap),
("mbs_cons_jdqd", mbs_cons_jdqd_wrap),
("mbs_sensor", mbs_sensor_wrap),
("mbs_gensensor", mbs_gensensor_wrap)]
("mbs_gensensor", mbs_gensensor_wrap)
]
#==============================================================================
# =============================================================================
# Functions_c
#==============================================================================
Functions_c._anonymous_ = ("user","symb")
Functions_c._fields_ =[
# =============================================================================
Functions_c._anonymous_ = ("user", "symb")
Functions_c._fields_ = [
("symbolicLibHandle", ctypes.POINTER(MbsDataLibInfo_c)),
("userfctLibHandle", ctypes.POINTER(MbsDataLibInfo_c)),
("symb", symb_c),
("user", user_c)]
("user", user_c)
]
#==============================================================================
# =============================================================================
# MbsData_c
#==============================================================================
# =============================================================================
MbsData_c._anonymous_ = ("fct",)
MbsData_c._fields_ =[
MbsData_c._fields_ = [
# Geometric and dynamic datas
("npt", ctypes.c_int),
("dpt", ctypes.POINTER(ctypes.POINTER(ctypes.c_double))),
("l", ctypes.POINTER(ctypes.POINTER(ctypes.c_double))),
("m", ctypes.POINTER(ctypes.c_double)),
("In", ctypes.POINTER(ctypes.POINTER(ctypes.c_double))),
("g", ctypes.c_double*(3+1)),
("g", ctypes.c_double * (3 + 1)),
("nbody", ctypes.c_int),
("njoint", ctypes.c_int),
......@@ -156,8 +139,8 @@ MbsData_c._fields_ =[
# Coordinate partiotionning datas
("nqu", ctypes.c_int),
("nqc", ctypes.c_int),
("nqlocked",ctypes.c_int),
("nqdriven",ctypes.c_int),
("nqlocked", ctypes.c_int),
("nqdriven", ctypes.c_int),
("nqa", ctypes.c_int),
("nqv", ctypes.c_int),
("nhu", ctypes.c_int),
......@@ -250,9 +233,10 @@ MbsData_c._fields_ =[
("project_path", ctypes.c_char_p),
("mbs_name", ctypes.c_char_p),
# REALTIME FLAG MUST BE UNDEFINED
#("realtime", ctypes.c_void_p),
# Pointer to projects functions
# PRJ_FCT_PTR MUST BE DEFINED
("fct", Functions_c)]
\ No newline at end of file
("fct", Functions_c)
# REALTIME FLAG can be defined
# ("realtime", ctypes.c_void_p),
]
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment