From f8106a9840a6a24a41b49ddf6b6fe81b3671a47c Mon Sep 17 00:00:00 2001 From: Tim Brooks <41971846+timryanb@users.noreply.github.com> Date: Wed, 19 Jul 2023 17:21:58 -0400 Subject: [PATCH 1/7] cython 3 fixes --- Makefile | 4 +- pyproject.toml | 2 +- tacs/TACS.pxd | 717 +---------------------------- tacs/TACS.pyx | 9 +- tacs/__init__.pxd | 0 tacs/constitutive.pxd | 196 +------- tacs/constitutive.pyx | 3 +- tacs/cpp_headers/TACS.pxd | 729 ++++++++++++++++++++++++++++++ tacs/cpp_headers/__init__.pxd | 0 tacs/cpp_headers/constitutive.pxd | 193 ++++++++ tacs/cpp_headers/elements.pxd | 407 +++++++++++++++++ tacs/cpp_headers/functions.pxd | 115 +++++ tacs/elements.pxd | 396 +--------------- tacs/elements.pyx | 5 +- tacs/functions.pxd | 111 +---- tacs/functions.pyx | 3 +- 16 files changed, 1467 insertions(+), 1423 deletions(-) create mode 100644 tacs/__init__.pxd create mode 100644 tacs/cpp_headers/TACS.pxd create mode 100644 tacs/cpp_headers/__init__.pxd create mode 100644 tacs/cpp_headers/constitutive.pxd create mode 100644 tacs/cpp_headers/elements.pxd create mode 100644 tacs/cpp_headers/functions.pxd diff --git a/Makefile b/Makefile index 698683eb1..ee64eb27c 100644 --- a/Makefile +++ b/Makefile @@ -35,11 +35,11 @@ default: fi ${CXX} ${SO_LINK_FLAGS} ${TACS_OBJS} ${TACS_EXTERN_LIBS} -o ${TACS_DIR}/lib/libtacs.${SO_EXT} @if [ "${TACS_IS_COMPLEX}" = "true" ]; then \ - echo "ctypedef complex TacsScalar" > tacs/TacsTypedefs.pxi; \ + echo "ctypedef complex TacsScalar" > tacs/cpp_headers/TacsTypedefs.pxi; \ echo "TACS_NPY_SCALAR = np.NPY_CDOUBLE" > tacs/TacsDefs.pxi; \ echo "dtype = complex" >> tacs/TacsDefs.pxi; \ else \ - echo "ctypedef double TacsScalar" > tacs/TacsTypedefs.pxi; \ + echo "ctypedef double TacsScalar" > tacs/cpp_headers/TacsTypedefs.pxi; \ echo "TACS_NPY_SCALAR = np.NPY_DOUBLE" > tacs/TacsDefs.pxi; \ echo "dtype = np.double" >> tacs/TacsDefs.pxi; \ fi diff --git a/pyproject.toml b/pyproject.toml index b8a3f7d5d..35ddd5e42 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ #pyproject.toml [build-system] # Minimum requirements for the build system to execute. -requires = ['setuptools>=45.0', 'wheel', 'cython>=0.29,<3.0', 'oldest-supported-numpy', +requires = ['setuptools>=45.0', 'wheel', 'cython>=0.29', 'oldest-supported-numpy', # Build against an old version (3.1.1) of mpi4py for forward compatibility "mpi4py==3.1.1; python_version<'3.11'", # Python 3.11 requires 3.1.4+ diff --git a/tacs/TACS.pxd b/tacs/TACS.pxd index 4c5d9f8ab..f3b25ffbb 100644 --- a/tacs/TACS.pxd +++ b/tacs/TACS.pxd @@ -20,16 +20,12 @@ cimport mpi4py.MPI as MPI from libc.string cimport const_char from libcpp cimport bool - -# Import the major python version -from cpython.version cimport PY_MAJOR_VERSION - # Import numpy cimport numpy as np import numpy as np -# Typdefs required for either real or complex mode -include "TacsTypedefs.pxi" +# Import TACS c++ headers +from tacs.cpp_headers.TACS cimport * cdef inline char* convert_to_chars(s): if isinstance(s, unicode): @@ -37,141 +33,7 @@ cdef inline char* convert_to_chars(s): return s cdef inline convert_bytes_to_str(bytes s): - if PY_MAJOR_VERSION >= 3: - return s.decode('utf8') - return s - -cdef extern from "TACSElementTypes.h": - enum: - TACS_OUTPUT_CONNECTIVITY - TACS_OUTPUT_NODES - TACS_OUTPUT_DISPLACEMENTS - TACS_OUTPUT_STRAINS - TACS_OUTPUT_STRESSES - TACS_OUTPUT_EXTRAS - TACS_OUTPUT_LOADS - - enum ElementType: - TACS_ELEMENT_NONE - TACS_SCALAR_2D_ELEMENT - TACS_SCALAR_3D_ELEMENT - TACS_BEAM_OR_SHELL_ELEMENT - TACS_PLANE_STRESS_ELEMENT - TACS_SOLID_ELEMENT - TACS_RIGID_ELEMENT - TACS_MASS_ELEMENT - TACS_SPRING_ELEMENT - TACS_PCM_ELEMENT - - enum ElementLayout: - TACS_LAYOUT_NONE - TACS_POINT_ELEMENT - TACS_LINE_ELEMENT - TACS_LINE_QUADRATIC_ELEMENT - TACS_LINE_CUBIC_ELEMENT - TACS_TRI_ELEMENT - TACS_TRI_QUADRATIC_ELEMENT - TACS_TRI_CUBIC_ELEMENT - TACS_QUAD_ELEMENT - TACS_QUAD_QUADRATIC_ELEMENT - TACS_QUAD_CUBIC_ELEMENT - TACS_QUAD_QUARTIC_ELEMENT - TACS_QUAD_QUINTIC_ELEMENT - TACS_TETRA_ELEMENT - TACS_TETRA_QUADRATIC_ELEMENT - TACS_TETRA_CUBIC_ELEMENT - TACS_HEXA_ELEMENT - TACS_HEXA_QUADRATIC_ELEMENT - TACS_HEXA_CUBIC_ELEMENT - TACS_HEXA_QUARTIC_ELEMENT - TACS_HEXA_QUINTIC_ELEMENT - TACS_PENTA_ELEMENT - TACS_PENTA_QUADRATIC_ELEMENT - TACS_PENTA_CUBIC_ELEMENT - - enum ElementMatrixType: - TACS_STIFFNESS_MATRIX - TACS_MASS_MATRIX - TACS_GEOMETRIC_STIFFNESS_MATRIX - TACS_STIFFNESS_PRODUCT_DERIVATIVE - -cdef extern from "KSM.h": - enum MatrixOrientation: - TACS_MAT_NORMAL - TACS_MAT_TRANSPOSE - -cdef extern from "TACSMaterialProperties.h": - enum MaterialType: - TACS_ISOTROPIC_MATERIAL - TACS_ANISOTROPIC_MATERIAL - -# Special functions required for converting pointers -cdef extern from "": - TACSSchurMat* _dynamicSchurMat "dynamic_cast"(TACSMat*) - TACSSchurPc* _dynamicSchurPc "dynamic_cast"(TACSPc*) - TACSParallelMat* _dynamicParallelMat "dynamic_cast"(TACSMat*) - TACSMg* _dynamicTACSMg "dynamic_cast"(TACSPc*) - GMRES* _dynamicGMRES "dynamic_cast"(TACSKsm*) - TACSBVec* _dynamicBVec "dynamic_cast"(TACSVec*) - TACSSpectralVec* _dynamicSpectralVec "dynamic_cast"(TACSVec*) - void deleteArray "delete []"(void*) - -cdef extern from "TACSObject.h": - cdef cppclass TACSObject: - void incref() - void decref() - const char* getObjectName() - - cdef MPI_Datatype TACS_MPI_TYPE - -cdef extern from "KSM.h": - cdef cppclass TACSVec(TACSObject): - TacsScalar norm() - void scale(TacsScalar alpha) - TacsScalar dot(TACSVec *x) - void axpy(TacsScalar alpha, TACSVec *x) - void copyValues(TACSVec *x) - void axpby(TacsScalar alpha, TacsScalar beta, TACSVec *x) - void zeroEntries() - void setRand(double lower, double upper) - - cdef cppclass TACSMat(TACSObject): - TACSVec *createVec() - void zeroEntries() - void mult(TACSVec *x, TACSVec *y) - void copyValues(TACSMat *mat) - void scale(TacsScalar alpha) - void axpy(TacsScalar alpha, TACSMat *mat) - void addDiag(TacsScalar) - - cdef cppclass TACSPc(TACSObject): - void factor() - void applyFactor(TACSVec *x, TACSVec *y) - void getMat(TACSMat**) - - cdef cppclass KSMPrint(TACSObject): - pass - - cdef cppclass KSMPrintStdout(KSMPrint): - KSMPrintStdout(char *descript, int rank, int freq) - - cdef cppclass TACSKsm(TACSObject): - TACSVec *createVec() - void setOperators(TACSMat *_mat, TACSPc *_pc) - void getOperators(TACSMat **_mat, TACSPc **_pc) - int solve(TACSVec *b, TACSVec *x, int zero_guess) - void setTolerances(double _rtol, double _atol) - void setMonitor(KSMPrint *_monitor) - int getIterCount() - TacsScalar getResidualNorm() - - cdef cppclass GMRES(TACSKsm): - GMRES(TACSMat *_mat, TACSPc *_pc, int _m, - int _nrestart, int _isFlexible ) - void setTimeMonitor() - - cdef cppclass TACSBcMap(TACSObject): - TACSBcMap(int, int) + return s.decode('utf8') cdef class BcMap: cdef TACSBcMap *ptr @@ -182,40 +44,6 @@ cdef inline _init_BcMap(TACSBcMap *ptr): bcmap.ptr.incref() return bcmap -cdef extern from "TACSBVec.h": - cdef cppclass TACSBVec(TACSVec): - TACSBVec(TACSNodeMap*, int) - int getSize(int*) - int getBlockSize() - TACSNodeMap *getNodeMap() - int getArray(TacsScalar**) - int readFromFile(const_char*) - int writeToFile(const_char*) - int getValues(int, const int*, TacsScalar*) - void setValues(int, const int*, const TacsScalar*, TACSBVecOperation) - void beginSetValues(TACSBVecOperation) - void endSetValues(TACSBVecOperation) - void beginDistributeValues() - void endDistributeValues() - -cdef extern from "TACSBVecDistribute.h": - enum TACSBVecOperation: - TACS_INSERT_VALUES - TACS_ADD_VALUES - TACS_INSERT_NONZERO_VALUES - - cdef cppclass TACSNodeMap(TACSObject): - TACSNodeMap(MPI_Comm, int) - MPI_Comm getMPIComm() - void getOwnerRange(const int**) - - cdef cppclass TACSBVecIndices(TACSObject): - TACSBVecIndices(int**, int) - int getIndices(const int **) - - cdef cppclass TACSBVecDistribute(TACSObject): - TACSBVecIndices *getIndices() - cdef class NodeMap: cdef TACSNodeMap *ptr @@ -234,17 +62,6 @@ cdef inline _init_VecIndices(TACSBVecIndices *ptr): indices.ptr.incref() return indices -cdef extern from "TACSBVecInterp.h": - cdef cppclass TACSBVecInterp(TACSObject): - TACSBVecInterp(TACSNodeMap*, TACSNodeMap*, int) - TACSBVecInterp(TACSAssembler*, TACSAssembler*) - void mult(TACSBVec*, TACSBVec*) - void multAdd(TACSBVec*, TACSBVec*, TACSBVec*) - void multTranspose(TACSBVec*, TACSBVec*) - void multTransposeAdd(TACSBVec*, TACSBVec*, TACSBVec*) - void multWeightTranspose(TACSBVec*, TACSBVec*) - void initialize() - cdef class VecInterp: cdef TACSBVecInterp *ptr @@ -254,51 +71,6 @@ cdef inline _init_VecInterp(TACSBVecInterp *ptr): interp.ptr.incref() return interp -cdef extern from "BCSRMat.h": - cdef cppclass BCSRMat(TACSObject): - int getBlockSize() - int getRowDim() - int getColDim() - void getDenseColumnMajor(TacsScalar*) - void getArrays(int*, int*, int*, const int**, const int**, TacsScalar**) - -cdef extern from "TACSParallelMat.h": - cdef cppclass TACSParallelMat(TACSMat): - void getBCSRMat(BCSRMat**, BCSRMat**) - - cdef cppclass TACSAdditiveSchwarz(TACSPc): - TACSAdditiveSchwarz(TACSParallelMat *mat, int levFill, double fill) - - cdef cppclass ApproximateSchur(TACSPc): - TACSApproximateSchur(TACSParallelMat *mat, int levFill, double fill, - int inner_gmres_iters, double inner_rtol, - double inner_atol) - -cdef extern from "TACSSchurMat.h": - cdef cppclass TACSSchurMat(TACSMat): - void getBCSRMat(BCSRMat**, BCSRMat**, BCSRMat**, BCSRMat**) - TACSBVecDistribute *getLocalMap() - TACSBVecDistribute *getSchurMap() - - cdef cppclass TACSSchurPc(TACSPc): - TACSSchurPc(TACSSchurMat *mat, int levFill, double fill, - int reorder_schur_complement) - void setMonitorFactorFlag(int) - void setMonitorBackSolveFlag(int) - -cdef extern from "TACSMg.h": - cdef cppclass TACSMg(TACSPc): - TACSMg(MPI_Comm, int, double, int, int) - void setLevel(int, TACSAssembler*, TACSBVecInterp*, int, int, - TACSMat*, TACSPc*) - void setVariables(TACSBVec*) - void assembleJacobian(double, double, double, TACSBVec*, - MatrixOrientation) - void assembleMatType(ElementMatrixType, MatrixOrientation) - void assembleMatCombo(ElementMatrixType*, TacsScalar*, int, MatrixOrientation) - int assembleGalerkinMat() - void setMonitor(KSMPrint*) - cdef class Vec: cdef TACSVec *ptr cdef TACSBVec* getBVecPtr(self) @@ -340,12 +112,6 @@ cdef inline _init_Mg(TACSMg *ptr): cdef class KSM: cdef TACSKsm *ptr -cdef extern from "TACSElementBasis.h": - cdef cppclass TACSElementBasis(TACSObject): - ElementLayout getLayoutType() - int getNumNodes() - int getNumParameters() - cdef class ElementBasis: cdef TACSElementBasis *ptr @@ -355,11 +121,6 @@ cdef inline _init_ElementBasis(TACSElementBasis *ptr): basis.ptr.incref() return basis -cdef extern from "TACSElementModel.h": - cdef cppclass TACSElementModel(TACSObject): - int getNumParameters() - int getVarsPerNode() - cdef class ElementModel: cdef TACSElementModel *ptr cdef object con @@ -370,28 +131,6 @@ cdef inline _init_ElementModel(TACSElementModel *ptr): model.ptr.incref() return model -cdef extern from "TACSElement.h": - cdef cppclass TACSElement(TACSObject): - void setComponentNum(int) - int getComponentNum() - @staticmethod - void setFiniteDifferenceOrder(int) - int getVarsPerNode() - int getNumNodes() - int getNumVariables() - int getDesignVarsPerNode() - int getDesignVarNums(int, int, int*) - int getDesignVars(int, int, TacsScalar*) - int setDesignVars(int, int, const TacsScalar*) - int getDesignVarRange(int, int, TacsScalar*, TacsScalar*) - TACSElementBasis* getElementBasis() - TACSElementModel* getElementModel() - ElementType getElementType() - TACSElement* createElementTraction(int, const TacsScalar*) - TACSElement* createElementPressure(int, TacsScalar) - TACSElement* createElementInertialForce(const TacsScalar*) - TACSElement* createElementCentrifugalForce(const TacsScalar*, const TacsScalar*, const bool) - cdef class Element: cdef TACSElement *ptr cdef object con @@ -403,24 +142,9 @@ cdef inline _init_Element(TACSElement *ptr): elem.ptr.incref() return elem -cdef extern from "TACSFunction.h": - cdef cppclass TACSFunction(TACSObject): - void setDomain(int, int*) - cdef class Function: cdef TACSFunction *ptr -cdef extern from "TACSConstitutive.h": - cdef cppclass TACSConstitutive(TACSObject): - int getNumStresses() - void evalStress(int, const double*, const TacsScalar*, - const TacsScalar*, TacsScalar*) - TacsScalar evalDesignFieldValue(int, const double*, - const TacsScalar*, int) - void getFailureEnvelope(int, int, const double*, - const TacsScalar*, const TacsScalar*, - const TacsScalar*, TacsScalar*, TacsScalar*) - cdef class Constitutive: cdef TACSConstitutive *ptr cdef object props @@ -432,130 +156,6 @@ cdef inline _init_Constitutive(TACSConstitutive *ptr): cons.ptr.incref() return cons -cdef extern from "TACSAuxElements.h": - cdef cppclass TACSAuxElements(TACSObject): - TACSAuxElements(int) - void addElement(int, TACSElement*) - -cdef extern from "TACSAssembler.h": - enum OrderingType"TACSAssembler::OrderingType": - TACS_NATURAL_ORDER"TACSAssembler::NATURAL_ORDER" - TACS_RCM_ORDER"TACSAssembler::RCM_ORDER" - TACS_ND_ORDER"TACSAssembler::ND_ORDER" - TACS_TACS_AMD_ORDER"TACSAssembler::TACS_AMD_ORDER" - TACS_MULTICOLOR_ORDER"TACSAssembler::MULTICOLOR_ORDER" - - enum MatrixOrderingType"TACSAssembler::MatrixOrderingType": - TACS_ADDITIVE_SCHWARZ"TACSAssembler::ADDITIVE_SCHWARZ" - TACS_APPROXIMATE_SCHUR"TACSAssembler::APPROXIMATE_SCHUR" - TACS_DIRECT_SCHUR"TACSAssembler::DIRECT_SCHUR" - TACS_GAUSS_SEIDEL"TACSAssembler::GAUSS_SEIDEL" - - cdef cppclass TACSAssembler(TACSObject): - TACSAssembler(MPI_Comm tacs_comm, int varsPerNode, - int numOwnedNodes, int numElements, - int numDependentNodes) - int setElementConnectivity(int *ptr, int *conn) - int setElements(TACSElement **elements) - int setDependentNodes(int *depNodeIndex, - int *depNodeToTacs, - double *depNodeWeights) - void setDesignNodeMap(int _designVarsPerNode, - TACSNodeMap *_designVarMap) - void addBCs(int nnodes, int *nodes, - int nbcs, int *vars, TacsScalar *vals) - void addInitBCs(int nnodes, int *nodes, - int nbcs, int *vars, TacsScalar *vals) - void setBCValuesFromVec(TACSBVec*) - void computeReordering(OrderingType, MatrixOrderingType) - void initialize() - int getVarsPerNode() - int getNumNodes() - int getNumDependentNodes() - int getNumOwnedNodes() - int getNumElements() - TACSNodeMap *getNodeMap() - TACSBcMap *getBcMap() - TACSElement **getElements() - TACSElement *getElement(int, TacsScalar*, TacsScalar*, - TacsScalar*, TacsScalar*) - TACSElement *getElement(int, int*, const int**) - MPI_Comm getMPIComm() - void setAuxElements(TACSAuxElements*) - TACSAuxElements *getAuxElements() - TACSBVec *createVec() - TACSParallelMat *createMat() - TACSSchurMat *createSchurMat(OrderingType) - TACSBVec *createNodeVec() - void setNodes(TACSBVec*) - void getNodes(TACSBVec*) - TACSBVec *createDesignVec() - void getDesignVars(TACSBVec*) - void setDesignVars(TACSBVec*) - void getDesignVarRange(TACSBVec*, TACSBVec*) - void getReordering(int*) - void reorderVec(TACSBVec*) - void setSimulationTime(double) - double getSimulationTime() - void applyBCs(TACSVec*) - void applyBCs(TACSMat*) - void setBCs(TACSVec*) - void zeroVariables() - void zeroDotVariables() - void zeroDDotVariables() - void setVariables(TACSBVec*, TACSBVec*, TACSBVec*) - void getVariables(TACSBVec*, TACSBVec*, TACSBVec*) - void copyVariables(TACSBVec*, TACSBVec*, TACSBVec*) - void getInitConditions(TACSBVec*, TACSBVec*, TACSBVec*) - void setInitConditions(TACSBVec*, TACSBVec*, TACSBVec*) - void evalEnergies(TacsScalar*, TacsScalar*) - void assembleRes(TACSBVec *residual, TacsScalar loadScale) - void assembleJacobian(double alpha, double beta, double gamma, - TACSBVec *residual, TACSMat *A, - MatrixOrientation matOr, - TacsScalar loadScale) - void assembleMatType(ElementMatrixType matType, - TACSMat *A, MatrixOrientation matOr, - TacsScalar loadScale) - void assembleMatCombo(ElementMatrixType*, TacsScalar*, int, - TACSMat*, MatrixOrientation matOr, - TacsScalar loadScale) - void addJacobianVecProduct(TacsScalar scale, - double alpha, double beta, double gamma, - TACSBVec *x, TACSBVec *y, - MatrixOrientation matOr, - TacsScalar loadScale) - void evalFunctions(int numFuncs, TACSFunction **functions, - TacsScalar *funcVals) - void addDVSens(double coef, int numFuncs, TACSFunction **funcs, - TACSBVec **dfdx) - void addSVSens(double alpha, double beta, double gamma, - int numFuncs, TACSFunction **funcs, - TACSBVec **fuSens) - void addAdjointResProducts(double scale, int numAdjoints, - TACSBVec **adjoint, TACSBVec **dfdx, - TacsScalar loadScale) - void addXptSens(double coef, int numFuncs, TACSFunction **funcs, - TACSBVec **fXptSens) - void addAdjointResXptSensProducts(double scale, int numAdjoints, - TACSBVec **adjoint, - TACSBVec **adjXptSens, - TacsScalar loadScale) - void addMatDVSensInnerProduct(double scale, - ElementMatrixType matType, - TACSBVec *psi, TACSBVec *phi, - TACSBVec *dfdx) - void evalMatSVSensInnerProduct(ElementMatrixType matType, - TACSBVec *psi, TACSBVec *phi, - TACSBVec *res) - - void testElement(int elemNum, int print_level, double dh, - double rtol, double atol) - void testFunction(TACSFunction *func, double dh) - - # Set the number of threads - void setNumThreads(int t) - cdef class Assembler: cdef TACSAssembler *ptr @@ -565,316 +165,5 @@ cdef inline _init_Assembler(TACSAssembler *ptr): tacs.ptr.incref() return tacs -cdef extern from "GSEP.h": - enum OrthoType"SEP::OrthoType": - FULL"SEP::FULL" - LOCAL"SEP::LOCAL" - - enum EigenSpectrum"SEP::EigenSpectrum": - SMALLEST"SEP::SMALLEST" - LARGEST"SEP::LARGEST" - SMALLEST_MAGNITUDE"SEP::SMALLEST_MAGNITUDE" - LARGEST_MAGNITUDE"SEP::LARGEST_MAGNITUDE" - - cdef cppclass EPOperator(TACSObject): - pass - - cdef cppclass EPRegular(EPOperator): - EPRegular(TACSMat*) - - cdef cppclass EPShiftInvert(EPOperator): - EPShiftInvert(TacsScalar, TACSKsm*) - - cdef cppclass EPGeneralizedShiftInvert(EPOperator): - EPGeneralizedShiftInvert(TacsScalar, TACSKsm*, TACSMat*) - - cdef cppclass SEP(TACSObject): - SEP(EPOperator*, int, OrthoType, TACSBcMap*) - void setTolerances(double, EigenSpectrum, int) - void solve(KSMPrint*, KSMPrint*) - TacsScalar extractEigenvalue(int, TacsScalar*) - TacsScalar extractEigenvector(int, TACSBVec*, TacsScalar*) - void printOrthogonality() - TacsScalar checkOrthogonality() - -cdef extern from "JacobiDavidson.h": - # Set the type of recycling scheme - enum JDRecycleType: - JD_SUM_TWO - JD_NUM_RECYCLE - - cdef cppclass TACSJacobiDavidsonOperator(TACSObject): - pass - - cdef cppclass TACSJDSimpleOperator(TACSJacobiDavidsonOperator): - TACSJDSimpleOperator(TACSAssembler*, TACSMat*, TACSPc*) - - cdef cppclass TACSJDFrequencyOperator(TACSJacobiDavidsonOperator): - TACSJDFrequencyOperator(TACSAssembler*, TACSMat*, - TACSMat*, TACSMat*, TACSPc*) - - cdef cppclass TACSJacobiDavidson(TACSObject): - TACSJacobiDavidson(TACSJacobiDavidsonOperator*, int, int, int) - MPI_Comm getMPIComm() - int getNumConvergedEigenvalues() - TacsScalar extractEigenvalue(int, TacsScalar*) - TacsScalar extractEigenvector(int n, TACSVec*, TacsScalar*) - void solve(KSMPrint*, int) - void setTolerances(double, double, double, double) - void setThetaCutoff(double) - void setRecycle(int, JDRecycleType) - cdef class JacobiDavidsonOperator: cdef TACSJacobiDavidsonOperator *ptr - -cdef extern from "TACSBuckling.h": - cdef cppclass TACSFrequencyAnalysis(TACSObject): - TACSFrequencyAnalysis(TACSAssembler *, TacsScalar, - TACSMat*, TACSMat*, TACSKsm*, - int, int, double) - TACSFrequencyAnalysis(TACSAssembler*, TacsScalar, - TACSMat*, TACSMat*, TACSMat*, - TACSPc*, - int, int, int, double, double, double, - int, JDRecycleType) - TACSAssembler* getAssembler() - TacsScalar getSigma() - void setSigma(TacsScalar) - void solve(KSMPrint*, int) - TacsScalar extractEigenvalue(int, TacsScalar*) - TacsScalar extractEigenvector(int, TACSBVec*, TacsScalar*) - void evalEigenDVSens(int, TACSBVec*) - void evalEigenXptSens(int, TACSBVec*) - - cdef cppclass TACSLinearBuckling(TACSObject): - TACSLinearBuckling( TACSAssembler *, - TacsScalar, - TACSMat *, TACSMat *, - TACSMat *, TACSKsm *, - int, int, double) - TACSAssembler* getAssembler() - TacsScalar getSigma() - void setSigma(TacsScalar) - void solve(TACSVec*, TACSVec*, KSMPrint*) - void evalEigenDVSens(int, TacsScalar, int) - TacsScalar extractEigenvalue(int, TacsScalar*) - TacsScalar extractEigenvector(int, TACSBVec*, TacsScalar*) - void evalEigenDVSens(int, TACSBVec*) - void evalEigenXptSens(int, TACSBVec*) - void addEigenDVSens(TacsScalar, int, TACSBVec*) - void addEigenXptSens(TacsScalar, int, TACSBVec*) - void evalEigenSVSens(int, TACSBVec*) - -cdef extern from "TACSMeshLoader.h": - cdef cppclass TACSMeshLoader(TACSObject): - TACSMeshLoader(MPI_Comm _comm) - int scanBDFFile(char *file_name) - int getNumComponents() - const char *getComponentDescript(int comp_num) - const char *getElementDescript(int comp_num) - void setElement(int component_num, TACSElement *_element) - int getNumNodes() - int getNumElements() - TACSAssembler* createTACS(int vars_per_node, - OrderingType order_type, - MatrixOrderingType mat_type) - void addAuxElement(TACSAuxElements *aux, int comp_num, - TACSElement *_element) - void addFunctionDomain(TACSFunction * function, - int num_comps, int *comp_nums) - void getConnectivity(int *_num_nodes, int *_num_elements, - const int **_elem_node_ptr, - const int **_elem_node_conn, - const int **elem_compoennts, - TacsScalar**_Xpts) - void getBCs(int *_num_bcs, const int **_bc_nodes, - const int **_bc_vars, const int **_bc_ptr, - const TacsScalar **_bc_vals) - -cdef extern from "TACSCreator.h": - cdef cppclass TACSCreator(TACSObject): - TACSCreator(MPI_Comm comm, int _vars_per_node) - void setGlobalConnectivity(int _num_nodes, int _num_elements, - int *_elem_node_ptr, - int *_elem_node_conn, - int *_elem_id_nums ) - void setBoundaryConditions(int _num_bcs, int *_bc_nodes, - int *_bc_vars, int *_bc_ptr, - TacsScalar *_bc_vals) - void setDependentNodes(int num_dep_nodes, - int *_dep_node_ptr, - int *_dep_node_conn, - double *_dep_node_weights ) - void setElements(int _num_elems, TACSElement **_elements) - void setNodes(TacsScalar *_Xpts) - void setReorderingType(OrderingType _order_type, - MatrixOrderingType _mat_type) - void partitionMesh(int split_size, int *part) - int getElementPartition(const int **) - TACSAssembler *createTACS() - int getNodeNums(const int**) - int getElementIdNums(int, int *, int **) - void getAssemblerNodeNums(TACSAssembler*, int, const int*, - int*, int**) - -cdef extern from "TACSToFH5.h": - cdef cppclass TACSToFH5(TACSObject): - TACSToFH5(TACSAssembler *_tacs, ElementType _elem_type, int _out_type) - void setComponentName(int comp_num, char *group_name) - void writeToFile(char *filename) - -cdef extern from "TACSFH5Loader.h": - cdef cppclass TACSFH5Loader(TACSObject): - TACSFH5Loader() - int loadData(const char*, const char*) - int getNumComponents(); - char* getComponentName( int comp ); - void getConnectivity(int*, int**, int**, int**, int**) - void getContinuousData(const char**, const char**, - int*, int*, float**) - void getElementData(const char**, const char**, - int*, int*, float**) - void getElementDataAsContinuous(int, float*) - void computeValueMask(ElementLayout, int, int, float, float, int*) - void computePlanarMask(ElementLayout, float*, float*, int*) - void getIsoSurfaces(ElementLayout, const int*, float, int, float*, int*, float**) - void getUnmatchedEdgesAndFaces(ElementLayout, const int*, - int, const float*, - int*, float**, float**, - int*, int**, int*, int**) - -cdef extern from "TACSIntegrator.h": - # Declare the TACSIntegrator base class - cdef cppclass TACSIntegrator(TACSObject): - # Setters for class variables - void setRelTol(double) - void setAbsTol(double) - void setMaxNewtonIters(int) - void setPrintLevel(int level, const_char *filename) - void setJacAssemblyFreq(int) - void setUseLapack(int) - void setUseSchurMat(int, OrderingType) - void setInitNewtonDeltaFraction(double) - void setKrylovSubspaceMethod(TACSKsm *_ksm) - void setTimeInterval(double, double) - void setFunctions(int num_funcs, TACSFunction **funcs, - int start_step, int end_step) - void lapackNaturalFrequencies(int, TACSBVec*, TACSBVec*, - TACSBVec*, TacsScalar*, TacsScalar*) - - # Forward mode functions - int iterate(int step_num,TACSBVec *forces) - int integrate() - void evalFunctions(TacsScalar *fvals) - - # Reverse mode functions - void iterateAdjoint(int step_num, TACSBVec **adj_rhs) - void initAdjoint(int step_num) - void integrateAdjoint() - void postAdjoint(int step_num) - void getAdjoint(int step_num, int func_num, TACSBVec **adjoint) - void getGradient(int func_num, TACSBVec **dfdx) - void getXptGradient(int func_num, TACSBVec **dfdXpt) - double getStates(int step_num, - TACSBVec **q, TACSBVec **qdot, TACSBVec **qddot) - - # Configure output - void setOutputPrefix(const_char *prefix) - void setOutputFrequency(int write_freq) - void setFH5(TACSToFH5 *_f5) - void writeSolution(const_char *filename, int format) - void writeSolutionToF5(); - void writeStepToF5(int step_num); - - int getNumTimeSteps() - void writeRawSolution(const_char *name, int format_flag) - - # Debug adjoint - void checkGradients(double dh) - - # BDF Implementation of the integrator - cdef cppclass TACSBDFIntegrator(TACSIntegrator): - TACSBDFIntegrator(TACSAssembler *tacs, - double tinit, double tfinal, - double num_steps, - int max_bdf_order) - - # DIRK Implementation of the integrator - cdef cppclass TACSDIRKIntegrator(TACSIntegrator): - TACSDIRKIntegrator(TACSAssembler *tacs, - double tinit, double tfinal, - double num_steps, - int stages) - - int iterateStage(int k, int s, TACSBVec *forces) - double getStageStates( int step, int stage, - TACSBVec **qS, TACSBVec **qdotS, TACSBVec **qddotS) - - # ESDIRK Implementation of the integrator - cdef cppclass TACSESDIRKIntegrator(TACSIntegrator): - TACSESDIRKIntegrator(TACSAssembler *tacs, - double tinit, double tfinal, - double num_steps, - int stages) - - int iterateStage(int k, int s, TACSBVec *forces) - double getStageStates( int step, int stage, - TACSBVec **qS, TACSBVec **qdotS, TACSBVec **qddotS) - - # ABM Implementation of the integrator - cdef cppclass TACSABMIntegrator(TACSIntegrator): - TACSABMIntegrator(TACSAssembler *tacs, - double tinit, double tfinal, - double num_steps, - int max_abm_order) - - # NBG Implementation of the integrator - cdef cppclass TACSNBGIntegrator(TACSIntegrator): - TACSNBGIntegrator(TACSAssembler *tacs, - double tinit, double tfinal, - double num_steps, - int order) - -cdef extern from "TACSSpectralIntegrator.h": - cdef cppclass TACSSpectralVec(TACSVec): - TacsScalar norm() - void scale(TacsScalar) - TacsScalar dot(TACSSpectralVec*) - void axpy(TacsScalar, TACSSpectralVec*) - void copyValues(TACSSpectralVec*) - void zeroEntries() - TACSBVec *getVec(int) - - cdef cppclass TACSLinearSpectralMat(TACSMat): - TACSLinearSpectralMat(TACSSpectralIntegrator*) - - cdef cppclass TACSLinearSpectralMg(TACSPc): - TACSLinearSpectralMg(TACSLinearSpectralMat*, int, - TACSAssembler**, TACSBVecInterp**, int*) - void factor() - - cdef cppclass TACSSpectralIntegrator(TACSObject): - TACSSpectralIntegrator(TACSAssembler*, double, int) - - int getNumLGLNodes() - double getPointAtLGLNode(int) - double getTimeAtLGLNode(int); - double getWeightAtLGLNode(int) - TACSAssembler *getAssembler() - - TACSSpectralVec *createVec() - TACSLinearSpectralMat *createLinearMat() - void setInitialConditions(TACSBVec*) - void setVariables(TACSSpectralVec*) - void assembleRes(TACSSpectralVec*res) - void assembleMat(TACSLinearSpectralMat*, - MatrixOrientation matOr) - - void evalFunctions(int, TACSFunction**, TacsScalar*) - void evalSVSens(TACSFunction*, TACSSpectralVec*) - void addDVSens(TACSFunction*, TACSBVec*) - void addAdjointResProduct(TacsScalar, TACSSpectralVec*, - TACSBVec*) - - # Compute the solution at a point in the time interval - void computeSolutionAndDeriv(double, TACSSpectralVec*, TACSBVec *u, TACSBVec*) diff --git a/tacs/TACS.pyx b/tacs/TACS.pyx index 37d842820..cd53f0a00 100644 --- a/tacs/TACS.pyx +++ b/tacs/TACS.pyx @@ -32,9 +32,6 @@ from libcpp cimport bool # Import C methods for python from cpython cimport PyObject, Py_INCREF -# Import the definitions -from TACS cimport * - # Include the definitions include "TacsDefs.pxi" @@ -153,7 +150,7 @@ cdef inplace_array_1d(int nptype, int dim1, void *data_ptr, # Set the base class who owns the memory if ptr != NULL: - ndarray.base = ptr + np.PyArray_SetBaseObject(ndarray, ptr) return ndarray @@ -177,7 +174,7 @@ cdef inplace_array_2d(int nptype, int dim1, int dim2, void *data_ptr, # Set the base class who owns the memory if ptr != NULL: - ndarray.base = ptr + np.PyArray_SetBaseObject(ndarray, ptr) return ndarray @@ -202,7 +199,7 @@ cdef inplace_array_3d(int nptype, int dim1, int dim2, int dim3, void *data_ptr, # Set the base class who owns the memory if ptr != NULL: - ndarray.base = ptr + np.PyArray_SetBaseObject(ndarray, ptr) return ndarray diff --git a/tacs/__init__.pxd b/tacs/__init__.pxd new file mode 100644 index 000000000..e69de29bb diff --git a/tacs/constitutive.pxd b/tacs/constitutive.pxd index a1888dfed..6c244ca22 100644 --- a/tacs/constitutive.pxd +++ b/tacs/constitutive.pxd @@ -12,59 +12,12 @@ #distutils: language=c++ -# For MPI capabilities -from mpi4py.libmpi cimport * -cimport mpi4py.MPI as MPI +# Import from cpp headers for definitions +from tacs.cpp_headers.TACS cimport * +from tacs.cpp_headers.constitutive cimport * -# Import numpy -import numpy as np -cimport numpy as np -from libc.string cimport const_char - -# Import C methods for python -from cpython cimport PyObject, Py_INCREF - -# Import from TACS for definitions -cimport TACS -from TACS cimport * - -cdef extern from "TACSMaterialProperties.h": - cdef cppclass TACSMaterialProperties(TACSObject): - TACSMaterialProperties(TacsScalar, TacsScalar, - TacsScalar, TacsScalar, - TacsScalar, TacsScalar, - TacsScalar) - TACSMaterialProperties(TacsScalar, TacsScalar, - TacsScalar, TacsScalar, TacsScalar, - TacsScalar, TacsScalar, TacsScalar, - TacsScalar, TacsScalar, TacsScalar, - TacsScalar, TacsScalar, - TacsScalar, TacsScalar, - TacsScalar, TacsScalar, - TacsScalar, TacsScalar, - TacsScalar, - TacsScalar, TacsScalar, TacsScalar, - TacsScalar, TacsScalar, TacsScalar) - void setDensity(TacsScalar) - TacsScalar getDensity(); - void setSpecificHeat(TacsScalar) - void getIsotropicProperties(TacsScalar*, TacsScalar*) - void getOrthotropicProperties(TacsScalar*, TacsScalar*, TacsScalar*, - TacsScalar*, TacsScalar*, TacsScalar*, - TacsScalar*, TacsScalar*, TacsScalar*) - void getStrengthProperties(TacsScalar*, TacsScalar*, TacsScalar*, - TacsScalar*, TacsScalar*, TacsScalar*, - TacsScalar*, TacsScalar*, TacsScalar*) - void getCoefThermalExpansion(TacsScalar*, TacsScalar*, TacsScalar*) - void getThermalConductivity(TacsScalar*, TacsScalar*, TacsScalar*) - - MaterialType getMaterialType(); - - cdef cppclass TACSOrthotropicPly(TACSObject): - TACSOrthotropicPly(TacsScalar, TACSMaterialProperties*) - void setKSWeight(TacsScalar) - void setUseMaxStrainCriterion() - void setUseTsaiWuCriterion() +# Import cython headers +from tacs.TACS cimport * cdef class MaterialProperties: cdef TACSMaterialProperties *ptr @@ -76,165 +29,26 @@ cdef inline _init_MaterialProperties(TACSMaterialProperties *ptr): props.ptr.incref() return props -cdef extern from "TACSPlaneStressConstitutive.h": - cdef cppclass TACSPlaneStressConstitutive(TACSConstitutive): - TACSPlaneStressConstitutive(TACSMaterialProperties*, - TacsScalar, int, TacsScalar, TacsScalar) - cdef class PlaneStressConstitutive(Constitutive): cdef TACSPlaneStressConstitutive *cptr -cdef extern from "TACSPhaseChangeMaterialConstitutive.h": - cdef cppclass TACSPhaseChangeMaterialConstitutive(TACSConstitutive): - TACSPhaseChangeMaterialConstitutive(TACSMaterialProperties*, - TACSMaterialProperties*, - TacsScalar, TacsScalar, - TacsScalar, TacsScalar, - int, TacsScalar, TacsScalar) - cdef class PhaseChangeMaterialConstitutive(Constitutive): cdef TACSPhaseChangeMaterialConstitutive *cptr -cdef extern from "TACSSolidConstitutive.h": - cdef cppclass TACSSolidConstitutive(TACSConstitutive): - TACSSolidConstitutive(TACSMaterialProperties*, - TacsScalar, int, TacsScalar, TacsScalar) - TACSMaterialProperties* getMaterialProperties() - cdef class SolidConstitutive(Constitutive): cdef TACSSolidConstitutive *cptr -cdef extern from "TACSShellConstitutive.h": - cdef cppclass TACSShellConstitutive(TACSConstitutive): - void setDrillingRegularization(double) - cdef class ShellConstitutive(Constitutive): cdef TACSShellConstitutive *cptr -cdef extern from "TACSIsoShellConstitutive.h": - cdef cppclass TACSIsoShellConstitutive(TACSShellConstitutive): - TACSIsoShellConstitutive(TACSMaterialProperties*, TacsScalar, int, - TacsScalar, TacsScalar) - -cdef extern from "TACSCompositeShellConstitutive.h": - cdef cppclass TACSCompositeShellConstitutive(TACSShellConstitutive): - TACSCompositeShellConstitutive(int, TACSOrthotropicPly**, const TacsScalar*, - const TacsScalar*, TacsScalar) - void getPlyThicknesses(TacsScalar*); - void getPlyAngles(TacsScalar*); - -cdef extern from "TACSLamParamShellConstitutive.h": - cdef cppclass TACSLamParamShellConstitutive(TACSShellConstitutive): - TACSLamParamShellConstitutive(TACSOrthotropicPly*, TacsScalar, int, TacsScalar, TacsScalar, - TacsScalar, TacsScalar, TacsScalar, int, int, int, - TacsScalar, TacsScalar, TacsScalar, - TacsScalar, TacsScalar, int, int, TacsScalar, TacsScalar) - -cdef extern from "TACSBladeStiffenedShellConstitutive.h": - cdef cppclass TACSBladeStiffenedShellConstitutive(TACSShellConstitutive): - TACSBladeStiffenedShellConstitutive( - TACSOrthotropicPly*, # panelPly - TACSOrthotropicPly*, # stiffenerPly - TacsScalar, # kcorr - TacsScalar, # panelLength - int, # panelLengthNum - TacsScalar, # stiffenerPitch - int, # stiffenerPitchNum - TacsScalar, # panelThick - int, # panelThickNum - int, # numPanelPlies - TacsScalar[], # panelPlyAngles - TacsScalar[], # panelPlyFracs - int[], # panelPlyFracNums - TacsScalar, # stiffenerHeight - int, # stiffenerHeightNum - TacsScalar, # stiffenerThick - int, # stiffenerThickNum - int, # numStiffenerPlies - TacsScalar[], # stiffenerPlyAngles - TacsScalar[], # stiffenerPlyFracs - int[], # stiffenerPlyFracNums - TacsScalar # flangeFraction - ) - int getNumPanelPlies() - int getNumStiffenerPlies() - void setKSWeight(double ksWeight) - void setStiffenerPitchBounds(TacsScalar lowerBound, TacsScalar upperBound) - void setStiffenerHeightBounds(TacsScalar lowerBound, TacsScalar upperBound) - void setStiffenerThicknessBounds(TacsScalar lowerBound, TacsScalar upperBound) - void setPanelThicknessBounds(TacsScalar lowerBound, TacsScalar upperBound) - void setStiffenerPlyFractionBounds(TacsScalar[] lowerBound, TacsScalar[] upperBound) - void setPanelPlyFractionBounds(TacsScalar[] lowerBound, TacsScalar[] upperBound) - cdef class BladeStiffenedShellConstitutive(ShellConstitutive): cdef TACSBladeStiffenedShellConstitutive *blade_ptr -cdef extern from "TACSBeamConstitutive.h": - cdef cppclass TACSBeamConstitutive(TACSConstitutive): - pass - cdef class BeamConstitutive(Constitutive): cdef TACSBeamConstitutive *cptr -cdef extern from "TACSBasicBeamConstitutive.h": - cdef cppclass TACSBasicBeamConstitutive(TACSBeamConstitutive): - TACSBasicBeamConstitutive(TACSMaterialProperties*, TacsScalar, TacsScalar, TacsScalar, - TacsScalar, TacsScalar, TacsScalar, TacsScalar) - -cdef extern from "TACSIsoTubeBeamConstitutive.h": - cdef cppclass TACSIsoTubeBeamConstitutive(TACSBeamConstitutive): - TACSIsoTubeBeamConstitutive(TACSMaterialProperties*, TacsScalar, TacsScalar, - int, int, TacsScalar, TacsScalar, TacsScalar, TacsScalar) - -cdef extern from "TACSIsoRectangleBeamConstitutive.h": - cdef cppclass TACSIsoRectangleBeamConstitutive(TACSBeamConstitutive): - TACSIsoRectangleBeamConstitutive(TACSMaterialProperties*, TacsScalar, TacsScalar, - int, int, TacsScalar, TacsScalar, TacsScalar, TacsScalar) - -cdef extern from "TACSGeneralMassConstitutive.h": - cdef cppclass TACSGeneralMassConstitutive(TACSConstitutive): - TACSGeneralMassConstitutive(const TacsScalar*) - void evalMassMatrix(int, const double*, const TacsScalar*, TacsScalar*) - cdef class GeneralMassConstitutive(Constitutive): cdef TACSGeneralMassConstitutive *cptr -cdef extern from "TACSPointMassConstitutive.h": - cdef cppclass TACSPointMassConstitutive(TACSGeneralMassConstitutive): - TACSPointMassConstitutive(TacsScalar, TacsScalar, TacsScalar, TacsScalar, TacsScalar, TacsScalar, TacsScalar, - int, TacsScalar, TacsScalar, int, TacsScalar, TacsScalar, int, TacsScalar, TacsScalar, - int, TacsScalar, TacsScalar, int, TacsScalar, TacsScalar, int, TacsScalar, TacsScalar, - int, TacsScalar, TacsScalar) - -cdef extern from "TACSGeneralSpringConstitutive.h": - cdef cppclass TACSGeneralSpringConstitutive(TACSConstitutive): - TACSGeneralSpringConstitutive(TacsScalar*) - void evalMassMatrix(int, const double *, const TacsScalar *, TacsScalar *) - cdef class GeneralSpringConstitutive(Constitutive): cdef TACSGeneralSpringConstitutive *cptr - -cdef extern from "TACSDOFSpringConstitutive.h": - cdef cppclass TACSDOFSpringConstitutive(TACSGeneralSpringConstitutive): - TACSDOFSpringConstitutive(TacsScalar*) - -# Special functions required for converting pointers -cdef extern from "": - TACSBeamConstitutive* _dynamicBeamConstitutive"dynamic_cast"(TACSConstitutive*) - -cdef extern from "TACSConstitutiveVerification.h": - int TacsTestConstitutiveDensity(TACSConstitutive*, int, const double*, const TacsScalar*, int, - const TacsScalar*, double, int, double, double) - int TacsTestConstitutiveSpecificHeat(TACSConstitutive*, int, const double*, const TacsScalar*, int, - const TacsScalar*, double, int, double, double) - int TacsTestConstitutiveHeatFlux(TACSConstitutive*, int, const double*, const TacsScalar*, int, - const TacsScalar*, double, int, double, double) - int TacsTestConstitutiveStress(TACSConstitutive*, int, const double*, const TacsScalar*, int, - const TacsScalar*, double, int, double, double) - int TacsTestConstitutiveThermalStrain(TACSConstitutive*, int, const double*, const TacsScalar*, int, - const TacsScalar*, double, int, double, double) - int TacsTestConstitutiveFailure(TACSConstitutive*, int, const double*, const TacsScalar*, int, - const TacsScalar*, double, int, double, double) - int TacsTestConstitutiveFailureStrainSens(TACSConstitutive*, int, const double*, const TacsScalar*, - double, int, double, double) - int TacsTestConstitutive(TACSConstitutive*, int, double, int, double, double) diff --git a/tacs/constitutive.pyx b/tacs/constitutive.pyx index 42ad8e4c5..fd3d64674 100644 --- a/tacs/constitutive.pyx +++ b/tacs/constitutive.pyx @@ -34,8 +34,7 @@ from libc.stdlib cimport malloc, free from cpython cimport PyObject, Py_INCREF # Import the definitions -from TACS cimport * -from constitutive cimport * +from tacs.TACS cimport * # Include the definitions include "TacsDefs.pxi" diff --git a/tacs/cpp_headers/TACS.pxd b/tacs/cpp_headers/TACS.pxd new file mode 100644 index 000000000..bb5a383a9 --- /dev/null +++ b/tacs/cpp_headers/TACS.pxd @@ -0,0 +1,729 @@ +# This file is part of TACS: The Toolkit for the Analysis of Composite +# Structures, a parallel finite-element code for structural and +# multidisciplinary design optimization. +# +# Copyright (C) 2014 Georgia Tech Research Corporation +# +# TACS is licensed under the Apache License, Version 2.0 (the +# "License"); you may not use this software except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 + +# distutils: language=c++ + +# For MPI capabilities +from mpi4py.libmpi cimport * +cimport mpi4py.MPI as MPI + +# Import numpy +from libc.string cimport const_char +from libcpp cimport bool + +# Typdefs required for either real or complex mode +include "TacsTypedefs.pxi" + +cdef extern from "TACSElementTypes.h": + enum: + TACS_OUTPUT_CONNECTIVITY + TACS_OUTPUT_NODES + TACS_OUTPUT_DISPLACEMENTS + TACS_OUTPUT_STRAINS + TACS_OUTPUT_STRESSES + TACS_OUTPUT_EXTRAS + TACS_OUTPUT_LOADS + + enum ElementType: + TACS_ELEMENT_NONE + TACS_SCALAR_2D_ELEMENT + TACS_SCALAR_3D_ELEMENT + TACS_BEAM_OR_SHELL_ELEMENT + TACS_PLANE_STRESS_ELEMENT + TACS_SOLID_ELEMENT + TACS_RIGID_ELEMENT + TACS_MASS_ELEMENT + TACS_SPRING_ELEMENT + TACS_PCM_ELEMENT + + enum ElementLayout: + TACS_LAYOUT_NONE + TACS_POINT_ELEMENT + TACS_LINE_ELEMENT + TACS_LINE_QUADRATIC_ELEMENT + TACS_LINE_CUBIC_ELEMENT + TACS_TRI_ELEMENT + TACS_TRI_QUADRATIC_ELEMENT + TACS_TRI_CUBIC_ELEMENT + TACS_QUAD_ELEMENT + TACS_QUAD_QUADRATIC_ELEMENT + TACS_QUAD_CUBIC_ELEMENT + TACS_QUAD_QUARTIC_ELEMENT + TACS_QUAD_QUINTIC_ELEMENT + TACS_TETRA_ELEMENT + TACS_TETRA_QUADRATIC_ELEMENT + TACS_TETRA_CUBIC_ELEMENT + TACS_HEXA_ELEMENT + TACS_HEXA_QUADRATIC_ELEMENT + TACS_HEXA_CUBIC_ELEMENT + TACS_HEXA_QUARTIC_ELEMENT + TACS_HEXA_QUINTIC_ELEMENT + TACS_PENTA_ELEMENT + TACS_PENTA_QUADRATIC_ELEMENT + TACS_PENTA_CUBIC_ELEMENT + + enum ElementMatrixType: + TACS_STIFFNESS_MATRIX + TACS_MASS_MATRIX + TACS_GEOMETRIC_STIFFNESS_MATRIX + TACS_STIFFNESS_PRODUCT_DERIVATIVE + +cdef extern from "KSM.h": + enum MatrixOrientation: + TACS_MAT_NORMAL + TACS_MAT_TRANSPOSE + +cdef extern from "TACSMaterialProperties.h": + enum MaterialType: + TACS_ISOTROPIC_MATERIAL + TACS_ANISOTROPIC_MATERIAL + +# Special functions required for converting pointers +cdef extern from "": + TACSSchurMat* _dynamicSchurMat "dynamic_cast"(TACSMat*) + TACSSchurPc* _dynamicSchurPc "dynamic_cast"(TACSPc*) + TACSParallelMat* _dynamicParallelMat "dynamic_cast"(TACSMat*) + TACSMg* _dynamicTACSMg "dynamic_cast"(TACSPc*) + GMRES* _dynamicGMRES "dynamic_cast"(TACSKsm*) + TACSBVec* _dynamicBVec "dynamic_cast"(TACSVec*) + TACSSpectralVec* _dynamicSpectralVec "dynamic_cast"(TACSVec*) + void deleteArray "delete []"(void*) + +cdef extern from "TACSObject.h": + cdef cppclass TACSObject: + void incref() + void decref() + const char* getObjectName() + + cdef MPI_Datatype TACS_MPI_TYPE + +cdef extern from "KSM.h": + cdef cppclass TACSVec(TACSObject): + TacsScalar norm() + void scale(TacsScalar alpha) + TacsScalar dot(TACSVec *x) + void axpy(TacsScalar alpha, TACSVec *x) + void copyValues(TACSVec *x) + void axpby(TacsScalar alpha, TacsScalar beta, TACSVec *x) + void zeroEntries() + void setRand(double lower, double upper) + + cdef cppclass TACSMat(TACSObject): + TACSVec *createVec() + void zeroEntries() + void mult(TACSVec *x, TACSVec *y) + void copyValues(TACSMat *mat) + void scale(TacsScalar alpha) + void axpy(TacsScalar alpha, TACSMat *mat) + void addDiag(TacsScalar) + + cdef cppclass TACSPc(TACSObject): + void factor() + void applyFactor(TACSVec *x, TACSVec *y) + void getMat(TACSMat**) + + cdef cppclass KSMPrint(TACSObject): + pass + + cdef cppclass KSMPrintStdout(KSMPrint): + KSMPrintStdout(char *descript, int rank, int freq) + + cdef cppclass TACSKsm(TACSObject): + TACSVec *createVec() + void setOperators(TACSMat *_mat, TACSPc *_pc) + void getOperators(TACSMat **_mat, TACSPc **_pc) + int solve(TACSVec *b, TACSVec *x, int zero_guess) + void setTolerances(double _rtol, double _atol) + void setMonitor(KSMPrint *_monitor) + int getIterCount() + TacsScalar getResidualNorm() + + cdef cppclass GMRES(TACSKsm): + GMRES(TACSMat *_mat, TACSPc *_pc, int _m, + int _nrestart, int _isFlexible ) + void setTimeMonitor() + + cdef cppclass TACSBcMap(TACSObject): + TACSBcMap(int, int) + +cdef extern from "TACSBVec.h": + cdef cppclass TACSBVec(TACSVec): + TACSBVec(TACSNodeMap*, int) + int getSize(int*) + int getBlockSize() + TACSNodeMap *getNodeMap() + int getArray(TacsScalar**) + int readFromFile(const_char*) + int writeToFile(const_char*) + int getValues(int, const int*, TacsScalar*) + void setValues(int, const int*, const TacsScalar*, TACSBVecOperation) + void beginSetValues(TACSBVecOperation) + void endSetValues(TACSBVecOperation) + void beginDistributeValues() + void endDistributeValues() + +cdef extern from "TACSBVecDistribute.h": + enum TACSBVecOperation: + TACS_INSERT_VALUES + TACS_ADD_VALUES + TACS_INSERT_NONZERO_VALUES + + cdef cppclass TACSNodeMap(TACSObject): + TACSNodeMap(MPI_Comm, int) + MPI_Comm getMPIComm() + void getOwnerRange(const int**) + + cdef cppclass TACSBVecIndices(TACSObject): + TACSBVecIndices(int**, int) + int getIndices(const int **) + + cdef cppclass TACSBVecDistribute(TACSObject): + TACSBVecIndices *getIndices() + +cdef extern from "TACSBVecInterp.h": + cdef cppclass TACSBVecInterp(TACSObject): + TACSBVecInterp(TACSNodeMap*, TACSNodeMap*, int) + TACSBVecInterp(TACSAssembler*, TACSAssembler*) + void mult(TACSBVec*, TACSBVec*) + void multAdd(TACSBVec*, TACSBVec*, TACSBVec*) + void multTranspose(TACSBVec*, TACSBVec*) + void multTransposeAdd(TACSBVec*, TACSBVec*, TACSBVec*) + void multWeightTranspose(TACSBVec*, TACSBVec*) + void initialize() + +cdef extern from "BCSRMat.h": + cdef cppclass BCSRMat(TACSObject): + int getBlockSize() + int getRowDim() + int getColDim() + void getDenseColumnMajor(TacsScalar*) + void getArrays(int*, int*, int*, const int**, const int**, TacsScalar**) + +cdef extern from "TACSParallelMat.h": + cdef cppclass TACSParallelMat(TACSMat): + void getBCSRMat(BCSRMat**, BCSRMat**) + + cdef cppclass TACSAdditiveSchwarz(TACSPc): + TACSAdditiveSchwarz(TACSParallelMat *mat, int levFill, double fill) + + cdef cppclass ApproximateSchur(TACSPc): + TACSApproximateSchur(TACSParallelMat *mat, int levFill, double fill, + int inner_gmres_iters, double inner_rtol, + double inner_atol) + +cdef extern from "TACSSchurMat.h": + cdef cppclass TACSSchurMat(TACSMat): + void getBCSRMat(BCSRMat**, BCSRMat**, BCSRMat**, BCSRMat**) + TACSBVecDistribute *getLocalMap() + TACSBVecDistribute *getSchurMap() + + cdef cppclass TACSSchurPc(TACSPc): + TACSSchurPc(TACSSchurMat *mat, int levFill, double fill, + int reorder_schur_complement) + void setMonitorFactorFlag(int) + void setMonitorBackSolveFlag(int) + +cdef extern from "TACSMg.h": + cdef cppclass TACSMg(TACSPc): + TACSMg(MPI_Comm, int, double, int, int) + void setLevel(int, TACSAssembler*, TACSBVecInterp*, int, int, + TACSMat*, TACSPc*) + void setVariables(TACSBVec*) + void assembleJacobian(double, double, double, TACSBVec*, + MatrixOrientation) + void assembleMatType(ElementMatrixType, MatrixOrientation) + void assembleMatCombo(ElementMatrixType*, TacsScalar*, int, MatrixOrientation) + int assembleGalerkinMat() + void setMonitor(KSMPrint*) + +cdef extern from "TACSElementBasis.h": + cdef cppclass TACSElementBasis(TACSObject): + ElementLayout getLayoutType() + int getNumNodes() + int getNumParameters() + +cdef extern from "TACSElementModel.h": + cdef cppclass TACSElementModel(TACSObject): + int getNumParameters() + int getVarsPerNode() + +cdef extern from "TACSElement.h": + cdef cppclass TACSElement(TACSObject): + void setComponentNum(int) + int getComponentNum() + @staticmethod + void setFiniteDifferenceOrder(int) + int getVarsPerNode() + int getNumNodes() + int getNumVariables() + int getDesignVarsPerNode() + int getDesignVarNums(int, int, int*) + int getDesignVars(int, int, TacsScalar*) + int setDesignVars(int, int, const TacsScalar*) + int getDesignVarRange(int, int, TacsScalar*, TacsScalar*) + TACSElementBasis* getElementBasis() + TACSElementModel* getElementModel() + ElementType getElementType() + TACSElement* createElementTraction(int, const TacsScalar*) + TACSElement* createElementPressure(int, TacsScalar) + TACSElement* createElementInertialForce(const TacsScalar*) + TACSElement* createElementCentrifugalForce(const TacsScalar*, const TacsScalar*, const bool) + +cdef extern from "TACSFunction.h": + cdef cppclass TACSFunction(TACSObject): + void setDomain(int, int*) + +cdef extern from "TACSConstitutive.h": + cdef cppclass TACSConstitutive(TACSObject): + int getNumStresses() + void evalStress(int, const double*, const TacsScalar*, + const TacsScalar*, TacsScalar*) + TacsScalar evalDesignFieldValue(int, const double*, + const TacsScalar*, int) + void getFailureEnvelope(int, int, const double*, + const TacsScalar*, const TacsScalar*, + const TacsScalar*, TacsScalar*, TacsScalar*) + +cdef extern from "TACSAuxElements.h": + cdef cppclass TACSAuxElements(TACSObject): + TACSAuxElements(int) + void addElement(int, TACSElement*) + +cdef extern from "TACSAssembler.h": + enum OrderingType"TACSAssembler::OrderingType": + TACS_NATURAL_ORDER"TACSAssembler::NATURAL_ORDER" + TACS_RCM_ORDER"TACSAssembler::RCM_ORDER" + TACS_ND_ORDER"TACSAssembler::ND_ORDER" + TACS_TACS_AMD_ORDER"TACSAssembler::TACS_AMD_ORDER" + TACS_MULTICOLOR_ORDER"TACSAssembler::MULTICOLOR_ORDER" + + enum MatrixOrderingType"TACSAssembler::MatrixOrderingType": + TACS_ADDITIVE_SCHWARZ"TACSAssembler::ADDITIVE_SCHWARZ" + TACS_APPROXIMATE_SCHUR"TACSAssembler::APPROXIMATE_SCHUR" + TACS_DIRECT_SCHUR"TACSAssembler::DIRECT_SCHUR" + TACS_GAUSS_SEIDEL"TACSAssembler::GAUSS_SEIDEL" + + cdef cppclass TACSAssembler(TACSObject): + TACSAssembler(MPI_Comm tacs_comm, int varsPerNode, + int numOwnedNodes, int numElements, + int numDependentNodes) + int setElementConnectivity(int *ptr, int *conn) + int setElements(TACSElement **elements) + int setDependentNodes(int *depNodeIndex, + int *depNodeToTacs, + double *depNodeWeights) + void setDesignNodeMap(int _designVarsPerNode, + TACSNodeMap *_designVarMap) + void addBCs(int nnodes, int *nodes, + int nbcs, int *vars, TacsScalar *vals) + void addInitBCs(int nnodes, int *nodes, + int nbcs, int *vars, TacsScalar *vals) + void setBCValuesFromVec(TACSBVec*) + void computeReordering(OrderingType, MatrixOrderingType) + void initialize() + int getVarsPerNode() + int getNumNodes() + int getNumDependentNodes() + int getNumOwnedNodes() + int getNumElements() + TACSNodeMap *getNodeMap() + TACSBcMap *getBcMap() + TACSElement **getElements() + TACSElement *getElement(int, TacsScalar*, TacsScalar*, + TacsScalar*, TacsScalar*) + TACSElement *getElement(int, int*, const int**) + MPI_Comm getMPIComm() + void setAuxElements(TACSAuxElements*) + TACSAuxElements *getAuxElements() + TACSBVec *createVec() + TACSParallelMat *createMat() + TACSSchurMat *createSchurMat(OrderingType) + TACSBVec *createNodeVec() + void setNodes(TACSBVec*) + void getNodes(TACSBVec*) + TACSBVec *createDesignVec() + void getDesignVars(TACSBVec*) + void setDesignVars(TACSBVec*) + void getDesignVarRange(TACSBVec*, TACSBVec*) + void getReordering(int*) + void reorderVec(TACSBVec*) + void setSimulationTime(double) + double getSimulationTime() + void applyBCs(TACSVec*) + void applyBCs(TACSMat*) + void setBCs(TACSVec*) + void zeroVariables() + void zeroDotVariables() + void zeroDDotVariables() + void setVariables(TACSBVec*, TACSBVec*, TACSBVec*) + void getVariables(TACSBVec*, TACSBVec*, TACSBVec*) + void copyVariables(TACSBVec*, TACSBVec*, TACSBVec*) + void getInitConditions(TACSBVec*, TACSBVec*, TACSBVec*) + void setInitConditions(TACSBVec*, TACSBVec*, TACSBVec*) + void evalEnergies(TacsScalar*, TacsScalar*) + void assembleRes(TACSBVec *residual, TacsScalar loadScale) + void assembleJacobian(double alpha, double beta, double gamma, + TACSBVec *residual, TACSMat *A, + MatrixOrientation matOr, + TacsScalar loadScale) + void assembleMatType(ElementMatrixType matType, + TACSMat *A, MatrixOrientation matOr, + TacsScalar loadScale) + void assembleMatCombo(ElementMatrixType*, TacsScalar*, int, + TACSMat*, MatrixOrientation matOr, + TacsScalar loadScale) + void addJacobianVecProduct(TacsScalar scale, + double alpha, double beta, double gamma, + TACSBVec *x, TACSBVec *y, + MatrixOrientation matOr, + TacsScalar loadScale) + void evalFunctions(int numFuncs, TACSFunction **functions, + TacsScalar *funcVals) + void addDVSens(double coef, int numFuncs, TACSFunction **funcs, + TACSBVec **dfdx) + void addSVSens(double alpha, double beta, double gamma, + int numFuncs, TACSFunction **funcs, + TACSBVec **fuSens) + void addAdjointResProducts(double scale, int numAdjoints, + TACSBVec **adjoint, TACSBVec **dfdx, + TacsScalar loadScale) + void addXptSens(double coef, int numFuncs, TACSFunction **funcs, + TACSBVec **fXptSens) + void addAdjointResXptSensProducts(double scale, int numAdjoints, + TACSBVec **adjoint, + TACSBVec **adjXptSens, + TacsScalar loadScale) + void addMatDVSensInnerProduct(double scale, + ElementMatrixType matType, + TACSBVec *psi, TACSBVec *phi, + TACSBVec *dfdx) + void evalMatSVSensInnerProduct(ElementMatrixType matType, + TACSBVec *psi, TACSBVec *phi, + TACSBVec *res) + + void testElement(int elemNum, int print_level, double dh, + double rtol, double atol) + void testFunction(TACSFunction *func, double dh) + + # Set the number of threads + void setNumThreads(int t) + +cdef extern from "GSEP.h": + enum OrthoType"SEP::OrthoType": + FULL"SEP::FULL" + LOCAL"SEP::LOCAL" + + enum EigenSpectrum"SEP::EigenSpectrum": + SMALLEST"SEP::SMALLEST" + LARGEST"SEP::LARGEST" + SMALLEST_MAGNITUDE"SEP::SMALLEST_MAGNITUDE" + LARGEST_MAGNITUDE"SEP::LARGEST_MAGNITUDE" + + cdef cppclass EPOperator(TACSObject): + pass + + cdef cppclass EPRegular(EPOperator): + EPRegular(TACSMat*) + + cdef cppclass EPShiftInvert(EPOperator): + EPShiftInvert(TacsScalar, TACSKsm*) + + cdef cppclass EPGeneralizedShiftInvert(EPOperator): + EPGeneralizedShiftInvert(TacsScalar, TACSKsm*, TACSMat*) + + cdef cppclass SEP(TACSObject): + SEP(EPOperator*, int, OrthoType, TACSBcMap*) + void setTolerances(double, EigenSpectrum, int) + void solve(KSMPrint*, KSMPrint*) + TacsScalar extractEigenvalue(int, TacsScalar*) + TacsScalar extractEigenvector(int, TACSBVec*, TacsScalar*) + void printOrthogonality() + TacsScalar checkOrthogonality() + +cdef extern from "JacobiDavidson.h": + # Set the type of recycling scheme + enum JDRecycleType: + JD_SUM_TWO + JD_NUM_RECYCLE + + cdef cppclass TACSJacobiDavidsonOperator(TACSObject): + pass + + cdef cppclass TACSJDSimpleOperator(TACSJacobiDavidsonOperator): + TACSJDSimpleOperator(TACSAssembler*, TACSMat*, TACSPc*) + + cdef cppclass TACSJDFrequencyOperator(TACSJacobiDavidsonOperator): + TACSJDFrequencyOperator(TACSAssembler*, TACSMat*, + TACSMat*, TACSMat*, TACSPc*) + + cdef cppclass TACSJacobiDavidson(TACSObject): + TACSJacobiDavidson(TACSJacobiDavidsonOperator*, int, int, int) + MPI_Comm getMPIComm() + int getNumConvergedEigenvalues() + TacsScalar extractEigenvalue(int, TacsScalar*) + TacsScalar extractEigenvector(int n, TACSVec*, TacsScalar*) + void solve(KSMPrint*, int) + void setTolerances(double, double, double, double) + void setThetaCutoff(double) + void setRecycle(int, JDRecycleType) + +cdef extern from "TACSBuckling.h": + cdef cppclass TACSFrequencyAnalysis(TACSObject): + TACSFrequencyAnalysis(TACSAssembler *, TacsScalar, + TACSMat*, TACSMat*, TACSKsm*, + int, int, double) + TACSFrequencyAnalysis(TACSAssembler*, TacsScalar, + TACSMat*, TACSMat*, TACSMat*, + TACSPc*, + int, int, int, double, double, double, + int, JDRecycleType) + TACSAssembler* getAssembler() + TacsScalar getSigma() + void setSigma(TacsScalar) + void solve(KSMPrint*, int) + TacsScalar extractEigenvalue(int, TacsScalar*) + TacsScalar extractEigenvector(int, TACSBVec*, TacsScalar*) + void evalEigenDVSens(int, TACSBVec*) + void evalEigenXptSens(int, TACSBVec*) + + cdef cppclass TACSLinearBuckling(TACSObject): + TACSLinearBuckling( TACSAssembler *, + TacsScalar, + TACSMat *, TACSMat *, + TACSMat *, TACSKsm *, + int, int, double) + TACSAssembler* getAssembler() + TacsScalar getSigma() + void setSigma(TacsScalar) + void solve(TACSVec*, TACSVec*, KSMPrint*) + void evalEigenDVSens(int, TacsScalar, int) + TacsScalar extractEigenvalue(int, TacsScalar*) + TacsScalar extractEigenvector(int, TACSBVec*, TacsScalar*) + void evalEigenDVSens(int, TACSBVec*) + void evalEigenXptSens(int, TACSBVec*) + void addEigenDVSens(TacsScalar, int, TACSBVec*) + void addEigenXptSens(TacsScalar, int, TACSBVec*) + void evalEigenSVSens(int, TACSBVec*) + +cdef extern from "TACSMeshLoader.h": + cdef cppclass TACSMeshLoader(TACSObject): + TACSMeshLoader(MPI_Comm _comm) + int scanBDFFile(char *file_name) + int getNumComponents() + const char *getComponentDescript(int comp_num) + const char *getElementDescript(int comp_num) + void setElement(int component_num, TACSElement *_element) + int getNumNodes() + int getNumElements() + TACSAssembler* createTACS(int vars_per_node, + OrderingType order_type, + MatrixOrderingType mat_type) + void addAuxElement(TACSAuxElements *aux, int comp_num, + TACSElement *_element) + void addFunctionDomain(TACSFunction * function, + int num_comps, int *comp_nums) + void getConnectivity(int *_num_nodes, int *_num_elements, + const int **_elem_node_ptr, + const int **_elem_node_conn, + const int **elem_compoennts, + TacsScalar**_Xpts) + void getBCs(int *_num_bcs, const int **_bc_nodes, + const int **_bc_vars, const int **_bc_ptr, + const TacsScalar **_bc_vals) + +cdef extern from "TACSCreator.h": + cdef cppclass TACSCreator(TACSObject): + TACSCreator(MPI_Comm comm, int _vars_per_node) + void setGlobalConnectivity(int _num_nodes, int _num_elements, + int *_elem_node_ptr, + int *_elem_node_conn, + int *_elem_id_nums ) + void setBoundaryConditions(int _num_bcs, int *_bc_nodes, + int *_bc_vars, int *_bc_ptr, + TacsScalar *_bc_vals) + void setDependentNodes(int num_dep_nodes, + int *_dep_node_ptr, + int *_dep_node_conn, + double *_dep_node_weights ) + void setElements(int _num_elems, TACSElement **_elements) + void setNodes(TacsScalar *_Xpts) + void setReorderingType(OrderingType _order_type, + MatrixOrderingType _mat_type) + void partitionMesh(int split_size, int *part) + int getElementPartition(const int **) + TACSAssembler *createTACS() + int getNodeNums(const int**) + int getElementIdNums(int, int *, int **) + void getAssemblerNodeNums(TACSAssembler*, int, const int*, + int*, int**) + +cdef extern from "TACSToFH5.h": + cdef cppclass TACSToFH5(TACSObject): + TACSToFH5(TACSAssembler *_tacs, ElementType _elem_type, int _out_type) + void setComponentName(int comp_num, char *group_name) + void writeToFile(char *filename) + +cdef extern from "TACSFH5Loader.h": + cdef cppclass TACSFH5Loader(TACSObject): + TACSFH5Loader() + int loadData(const char*, const char*) + int getNumComponents(); + char* getComponentName( int comp ); + void getConnectivity(int*, int**, int**, int**, int**) + void getContinuousData(const char**, const char**, + int*, int*, float**) + void getElementData(const char**, const char**, + int*, int*, float**) + void getElementDataAsContinuous(int, float*) + void computeValueMask(ElementLayout, int, int, float, float, int*) + void computePlanarMask(ElementLayout, float*, float*, int*) + void getIsoSurfaces(ElementLayout, const int*, float, int, float*, int*, float**) + void getUnmatchedEdgesAndFaces(ElementLayout, const int*, + int, const float*, + int*, float**, float**, + int*, int**, int*, int**) + +cdef extern from "TACSIntegrator.h": + # Declare the TACSIntegrator base class + cdef cppclass TACSIntegrator(TACSObject): + # Setters for class variables + void setRelTol(double) + void setAbsTol(double) + void setMaxNewtonIters(int) + void setPrintLevel(int level, const_char *filename) + void setJacAssemblyFreq(int) + void setUseLapack(int) + void setUseSchurMat(int, OrderingType) + void setInitNewtonDeltaFraction(double) + void setKrylovSubspaceMethod(TACSKsm *_ksm) + void setTimeInterval(double, double) + void setFunctions(int num_funcs, TACSFunction **funcs, + int start_step, int end_step) + void lapackNaturalFrequencies(int, TACSBVec*, TACSBVec*, + TACSBVec*, TacsScalar*, TacsScalar*) + + # Forward mode functions + int iterate(int step_num,TACSBVec *forces) + int integrate() + void evalFunctions(TacsScalar *fvals) + + # Reverse mode functions + void iterateAdjoint(int step_num, TACSBVec **adj_rhs) + void initAdjoint(int step_num) + void integrateAdjoint() + void postAdjoint(int step_num) + void getAdjoint(int step_num, int func_num, TACSBVec **adjoint) + void getGradient(int func_num, TACSBVec **dfdx) + void getXptGradient(int func_num, TACSBVec **dfdXpt) + double getStates(int step_num, + TACSBVec **q, TACSBVec **qdot, TACSBVec **qddot) + + # Configure output + void setOutputPrefix(const_char *prefix) + void setOutputFrequency(int write_freq) + void setFH5(TACSToFH5 *_f5) + void writeSolution(const_char *filename, int format) + void writeSolutionToF5(); + void writeStepToF5(int step_num); + + int getNumTimeSteps() + void writeRawSolution(const_char *name, int format_flag) + + # Debug adjoint + void checkGradients(double dh) + + # BDF Implementation of the integrator + cdef cppclass TACSBDFIntegrator(TACSIntegrator): + TACSBDFIntegrator(TACSAssembler *tacs, + double tinit, double tfinal, + double num_steps, + int max_bdf_order) + + # DIRK Implementation of the integrator + cdef cppclass TACSDIRKIntegrator(TACSIntegrator): + TACSDIRKIntegrator(TACSAssembler *tacs, + double tinit, double tfinal, + double num_steps, + int stages) + + int iterateStage(int k, int s, TACSBVec *forces) + double getStageStates( int step, int stage, + TACSBVec **qS, TACSBVec **qdotS, TACSBVec **qddotS) + + # ESDIRK Implementation of the integrator + cdef cppclass TACSESDIRKIntegrator(TACSIntegrator): + TACSESDIRKIntegrator(TACSAssembler *tacs, + double tinit, double tfinal, + double num_steps, + int stages) + + int iterateStage(int k, int s, TACSBVec *forces) + double getStageStates( int step, int stage, + TACSBVec **qS, TACSBVec **qdotS, TACSBVec **qddotS) + + # ABM Implementation of the integrator + cdef cppclass TACSABMIntegrator(TACSIntegrator): + TACSABMIntegrator(TACSAssembler *tacs, + double tinit, double tfinal, + double num_steps, + int max_abm_order) + + # NBG Implementation of the integrator + cdef cppclass TACSNBGIntegrator(TACSIntegrator): + TACSNBGIntegrator(TACSAssembler *tacs, + double tinit, double tfinal, + double num_steps, + int order) + +cdef extern from "TACSSpectralIntegrator.h": + cdef cppclass TACSSpectralVec(TACSVec): + TacsScalar norm() + void scale(TacsScalar) + TacsScalar dot(TACSSpectralVec*) + void axpy(TacsScalar, TACSSpectralVec*) + void copyValues(TACSSpectralVec*) + void zeroEntries() + TACSBVec *getVec(int) + + cdef cppclass TACSLinearSpectralMat(TACSMat): + TACSLinearSpectralMat(TACSSpectralIntegrator*) + + cdef cppclass TACSLinearSpectralMg(TACSPc): + TACSLinearSpectralMg(TACSLinearSpectralMat*, int, + TACSAssembler**, TACSBVecInterp**, int*) + void factor() + + cdef cppclass TACSSpectralIntegrator(TACSObject): + TACSSpectralIntegrator(TACSAssembler*, double, int) + + int getNumLGLNodes() + double getPointAtLGLNode(int) + double getTimeAtLGLNode(int); + double getWeightAtLGLNode(int) + TACSAssembler *getAssembler() + + TACSSpectralVec *createVec() + TACSLinearSpectralMat *createLinearMat() + void setInitialConditions(TACSBVec*) + void setVariables(TACSSpectralVec*) + void assembleRes(TACSSpectralVec*res) + void assembleMat(TACSLinearSpectralMat*, + MatrixOrientation matOr) + + void evalFunctions(int, TACSFunction**, TacsScalar*) + void evalSVSens(TACSFunction*, TACSSpectralVec*) + void addDVSens(TACSFunction*, TACSBVec*) + void addAdjointResProduct(TacsScalar, TACSSpectralVec*, + TACSBVec*) + + # Compute the solution at a point in the time interval + void computeSolutionAndDeriv(double, TACSSpectralVec*, TACSBVec *u, TACSBVec*) diff --git a/tacs/cpp_headers/__init__.pxd b/tacs/cpp_headers/__init__.pxd new file mode 100644 index 000000000..e69de29bb diff --git a/tacs/cpp_headers/constitutive.pxd b/tacs/cpp_headers/constitutive.pxd new file mode 100644 index 000000000..bf147a3fd --- /dev/null +++ b/tacs/cpp_headers/constitutive.pxd @@ -0,0 +1,193 @@ +# This file is part of TACS: The Toolkit for the Analysis of Composite +# Structures, a parallel finite-element code for structural and +# multidisciplinary design optimization. +# +# Copyright (C) 2014 Georgia Tech Research Corporation +# +# TACS is licensed under the Apache License, Version 2.0 (the +# "License"); you may not use this software except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 + +#distutils: language=c++ + +# Import from TACS for definitions +from tacs.cpp_headers.TACS cimport * + +cdef extern from "TACSMaterialProperties.h": + cdef cppclass TACSMaterialProperties(TACSObject): + TACSMaterialProperties(TacsScalar, TacsScalar, + TacsScalar, TacsScalar, + TacsScalar, TacsScalar, + TacsScalar) + TACSMaterialProperties(TacsScalar, TacsScalar, + TacsScalar, TacsScalar, TacsScalar, + TacsScalar, TacsScalar, TacsScalar, + TacsScalar, TacsScalar, TacsScalar, + TacsScalar, TacsScalar, + TacsScalar, TacsScalar, + TacsScalar, TacsScalar, + TacsScalar, TacsScalar, + TacsScalar, + TacsScalar, TacsScalar, TacsScalar, + TacsScalar, TacsScalar, TacsScalar) + void setDensity(TacsScalar) + TacsScalar getDensity(); + void setSpecificHeat(TacsScalar) + void getIsotropicProperties(TacsScalar*, TacsScalar*) + void getOrthotropicProperties(TacsScalar*, TacsScalar*, TacsScalar*, + TacsScalar*, TacsScalar*, TacsScalar*, + TacsScalar*, TacsScalar*, TacsScalar*) + void getStrengthProperties(TacsScalar*, TacsScalar*, TacsScalar*, + TacsScalar*, TacsScalar*, TacsScalar*, + TacsScalar*, TacsScalar*, TacsScalar*) + void getCoefThermalExpansion(TacsScalar*, TacsScalar*, TacsScalar*) + void getThermalConductivity(TacsScalar*, TacsScalar*, TacsScalar*) + + MaterialType getMaterialType(); + + cdef cppclass TACSOrthotropicPly(TACSObject): + TACSOrthotropicPly(TacsScalar, TACSMaterialProperties*) + void setKSWeight(TacsScalar) + void setUseMaxStrainCriterion() + void setUseTsaiWuCriterion() + +cdef extern from "TACSPlaneStressConstitutive.h": + cdef cppclass TACSPlaneStressConstitutive(TACSConstitutive): + TACSPlaneStressConstitutive(TACSMaterialProperties*, + TacsScalar, int, TacsScalar, TacsScalar) + +cdef extern from "TACSPhaseChangeMaterialConstitutive.h": + cdef cppclass TACSPhaseChangeMaterialConstitutive(TACSConstitutive): + TACSPhaseChangeMaterialConstitutive(TACSMaterialProperties*, + TACSMaterialProperties*, + TacsScalar, TacsScalar, + TacsScalar, TacsScalar, + int, TacsScalar, TacsScalar) + +cdef extern from "TACSSolidConstitutive.h": + cdef cppclass TACSSolidConstitutive(TACSConstitutive): + TACSSolidConstitutive(TACSMaterialProperties*, + TacsScalar, int, TacsScalar, TacsScalar) + TACSMaterialProperties* getMaterialProperties() + +cdef extern from "TACSShellConstitutive.h": + cdef cppclass TACSShellConstitutive(TACSConstitutive): + void setDrillingRegularization(double) + +cdef extern from "TACSIsoShellConstitutive.h": + cdef cppclass TACSIsoShellConstitutive(TACSShellConstitutive): + TACSIsoShellConstitutive(TACSMaterialProperties*, TacsScalar, int, + TacsScalar, TacsScalar) + +cdef extern from "TACSCompositeShellConstitutive.h": + cdef cppclass TACSCompositeShellConstitutive(TACSShellConstitutive): + TACSCompositeShellConstitutive(int, TACSOrthotropicPly**, const TacsScalar*, + const TacsScalar*, TacsScalar) + void getPlyThicknesses(TacsScalar*); + void getPlyAngles(TacsScalar*); + +cdef extern from "TACSLamParamShellConstitutive.h": + cdef cppclass TACSLamParamShellConstitutive(TACSShellConstitutive): + TACSLamParamShellConstitutive(TACSOrthotropicPly*, TacsScalar, int, TacsScalar, TacsScalar, + TacsScalar, TacsScalar, TacsScalar, int, int, int, + TacsScalar, TacsScalar, TacsScalar, + TacsScalar, TacsScalar, int, int, TacsScalar, TacsScalar) + +cdef extern from "TACSBladeStiffenedShellConstitutive.h": + cdef cppclass TACSBladeStiffenedShellConstitutive(TACSShellConstitutive): + TACSBladeStiffenedShellConstitutive( + TACSOrthotropicPly*, # panelPly + TACSOrthotropicPly*, # stiffenerPly + TacsScalar, # kcorr + TacsScalar, # panelLength + int, # panelLengthNum + TacsScalar, # stiffenerPitch + int, # stiffenerPitchNum + TacsScalar, # panelThick + int, # panelThickNum + int, # numPanelPlies + TacsScalar[], # panelPlyAngles + TacsScalar[], # panelPlyFracs + int[], # panelPlyFracNums + TacsScalar, # stiffenerHeight + int, # stiffenerHeightNum + TacsScalar, # stiffenerThick + int, # stiffenerThickNum + int, # numStiffenerPlies + TacsScalar[], # stiffenerPlyAngles + TacsScalar[], # stiffenerPlyFracs + int[], # stiffenerPlyFracNums + TacsScalar # flangeFraction + ) + int getNumPanelPlies() + int getNumStiffenerPlies() + void setKSWeight(double ksWeight) + void setStiffenerPitchBounds(TacsScalar lowerBound, TacsScalar upperBound) + void setStiffenerHeightBounds(TacsScalar lowerBound, TacsScalar upperBound) + void setStiffenerThicknessBounds(TacsScalar lowerBound, TacsScalar upperBound) + void setPanelThicknessBounds(TacsScalar lowerBound, TacsScalar upperBound) + void setStiffenerPlyFractionBounds(TacsScalar[] lowerBound, TacsScalar[] upperBound) + void setPanelPlyFractionBounds(TacsScalar[] lowerBound, TacsScalar[] upperBound) + +cdef extern from "TACSBeamConstitutive.h": + cdef cppclass TACSBeamConstitutive(TACSConstitutive): + pass + +cdef extern from "TACSBasicBeamConstitutive.h": + cdef cppclass TACSBasicBeamConstitutive(TACSBeamConstitutive): + TACSBasicBeamConstitutive(TACSMaterialProperties*, TacsScalar, TacsScalar, TacsScalar, + TacsScalar, TacsScalar, TacsScalar, TacsScalar) + +cdef extern from "TACSIsoTubeBeamConstitutive.h": + cdef cppclass TACSIsoTubeBeamConstitutive(TACSBeamConstitutive): + TACSIsoTubeBeamConstitutive(TACSMaterialProperties*, TacsScalar, TacsScalar, + int, int, TacsScalar, TacsScalar, TacsScalar, TacsScalar) + +cdef extern from "TACSIsoRectangleBeamConstitutive.h": + cdef cppclass TACSIsoRectangleBeamConstitutive(TACSBeamConstitutive): + TACSIsoRectangleBeamConstitutive(TACSMaterialProperties*, TacsScalar, TacsScalar, + int, int, TacsScalar, TacsScalar, TacsScalar, TacsScalar) + +cdef extern from "TACSGeneralMassConstitutive.h": + cdef cppclass TACSGeneralMassConstitutive(TACSConstitutive): + TACSGeneralMassConstitutive(const TacsScalar*) + void evalMassMatrix(int, const double*, const TacsScalar*, TacsScalar*) + +cdef extern from "TACSPointMassConstitutive.h": + cdef cppclass TACSPointMassConstitutive(TACSGeneralMassConstitutive): + TACSPointMassConstitutive(TacsScalar, TacsScalar, TacsScalar, TacsScalar, TacsScalar, TacsScalar, TacsScalar, + int, TacsScalar, TacsScalar, int, TacsScalar, TacsScalar, int, TacsScalar, TacsScalar, + int, TacsScalar, TacsScalar, int, TacsScalar, TacsScalar, int, TacsScalar, TacsScalar, + int, TacsScalar, TacsScalar) + +cdef extern from "TACSGeneralSpringConstitutive.h": + cdef cppclass TACSGeneralSpringConstitutive(TACSConstitutive): + TACSGeneralSpringConstitutive(TacsScalar*) + void evalMassMatrix(int, const double *, const TacsScalar *, TacsScalar *) + +cdef extern from "TACSDOFSpringConstitutive.h": + cdef cppclass TACSDOFSpringConstitutive(TACSGeneralSpringConstitutive): + TACSDOFSpringConstitutive(TacsScalar*) + +# Special functions required for converting pointers +cdef extern from "": + TACSBeamConstitutive* _dynamicBeamConstitutive"dynamic_cast"(TACSConstitutive*) + +cdef extern from "TACSConstitutiveVerification.h": + int TacsTestConstitutiveDensity(TACSConstitutive*, int, const double*, const TacsScalar*, int, + const TacsScalar*, double, int, double, double) + int TacsTestConstitutiveSpecificHeat(TACSConstitutive*, int, const double*, const TacsScalar*, int, + const TacsScalar*, double, int, double, double) + int TacsTestConstitutiveHeatFlux(TACSConstitutive*, int, const double*, const TacsScalar*, int, + const TacsScalar*, double, int, double, double) + int TacsTestConstitutiveStress(TACSConstitutive*, int, const double*, const TacsScalar*, int, + const TacsScalar*, double, int, double, double) + int TacsTestConstitutiveThermalStrain(TACSConstitutive*, int, const double*, const TacsScalar*, int, + const TacsScalar*, double, int, double, double) + int TacsTestConstitutiveFailure(TACSConstitutive*, int, const double*, const TacsScalar*, int, + const TacsScalar*, double, int, double, double) + int TacsTestConstitutiveFailureStrainSens(TACSConstitutive*, int, const double*, const TacsScalar*, + double, int, double, double) + int TacsTestConstitutive(TACSConstitutive*, int, double, int, double, double) diff --git a/tacs/cpp_headers/elements.pxd b/tacs/cpp_headers/elements.pxd new file mode 100644 index 000000000..62f0b49ba --- /dev/null +++ b/tacs/cpp_headers/elements.pxd @@ -0,0 +1,407 @@ +# This file is part of TACS: The Toolkit for the Analysis of Composite +# Structures, a parallel finite-element code for structural and +# multidisciplinary design optimization. +# +# Copyright (C) 2014 Georgia Tech Research Corporation +# +# TACS is licensed under the Apache License, Version 2.0 (the +# "License"); you may not use this software except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 + +#distutils: language=c++ + +from cpython cimport PyObject + +# Import numpy +from libc.string cimport const_char + +# Import from constitutive for definitions +from tacs.cpp_headers.constitutive cimport * +from tacs.cpp_headers.TACS cimport * + +cdef extern from "TACSElementTypes.h": + const int TACS_ELEMENT_DENSITY + const int TACS_STRAIN_ENERGY_DENSITY + const int TACS_FAILURE_INDEX + const int TACS_HEAT_FLUX + const int TACS_TEMPERATURE + const int TACS_TOTAL_STRAIN_ENERGY_DENSITY + const int TACS_ELEMENT_DISPLACEMENT + const int TACS_ELEMENT_STRAIN + const int TACS_ELEMENT_STRESS + +cdef extern from "TACSElementVerification.h": + int TacsTestElementBasisFunctions(TACSElementBasis*, double, int, double, double) + int TacsTestElementBasisFaceNormals(TACSElementBasis*, double, int, double, double) + int TacsTestElementBasisJacobianTransform(TACSElementBasis*, double, int, double, double) + int TacsTestElementBasis(TACSElementBasis*, double, int, double, double) + int TacsTestElementModelJacobian(TACSElementModel*, int, const double, double, int, double, double) + int TacsTestElementModelAdjXptSensProduct(TACSElementModel*, int, const double, double, int, double, double) + int TacsTestElementResidual(TACSElement*, int, double, const TacsScalar*, + const TacsScalar*, const TacsScalar*, + const TacsScalar*, double, int, double, + double) + int TacsTestElementJacobian(TACSElement*, int, double, const TacsScalar*, + const TacsScalar*, const TacsScalar*, + const TacsScalar*, int, double, int, double, + double) + int TacsTestAdjResProduct(TACSElement*, int, double, const TacsScalar*, + const TacsScalar*, const TacsScalar*, const TacsScalar*, + int, const TacsScalar*, double, int, double, double) + int TacsTestAdjResXptProduct(TACSElement*, int, double, const TacsScalar*, + const TacsScalar*, const TacsScalar*, + const TacsScalar*, double, int, double, + double) + int TacsTestElementMatDVSens(TACSElement*, ElementMatrixType, int, double, const TacsScalar*, const TacsScalar*, + int, const TacsScalar*, double, int, double, double) + int TacsTestElementMatXptSens(TACSElement*, ElementMatrixType, int, double, const TacsScalar*, const TacsScalar*, + double, int, double, double) + int TacsTestElementMatSVSens(TACSElement*, ElementMatrixType, int, double, const TacsScalar*, const TacsScalar*, + double, int, double, double) + int TacsSeedRandomGenerator(int) + +cdef extern from "TACSTetrahedralBasis.h": + cdef cppclass TACSLinearTetrahedralBasis(TACSElementBasis): + TACSLinearTetrahedralBasis() + + cdef cppclass TACSQuadraticTetrahedralBasis(TACSElementBasis): + TACSQuadraticTetrahedralBasis() + + cdef cppclass TACSCubicTetrahedralBasis(TACSElementBasis): + TACSCubicTetrahedralBasis() + +cdef extern from "TACSHexaBasis.h": + cdef cppclass TACSLinearHexaBasis(TACSElementBasis): + TACSLinearHexaBasis() + + cdef cppclass TACSQuadraticHexaBasis(TACSElementBasis): + TACSQuadraticHexaBasis() + + cdef cppclass TACSCubicHexaBasis(TACSElementBasis): + TACSCubicHexaBasis() + +cdef extern from "TACSQuadBasis.h": + cdef cppclass TACSLinearQuadBasis(TACSElementBasis): + TACSLinearQuadBasis() + + cdef cppclass TACSQuadraticQuadBasis(TACSElementBasis): + TACSQuadraticQuadBasis() + + cdef cppclass TACSCubicQuadBasis(TACSElementBasis): + TACSCubicQuadBasis() + + cdef cppclass TACSQuarticQuadBasis(TACSElementBasis): + TACSQuarticQuadBasis() + + cdef cppclass TACSQuinticQuadBasis(TACSElementBasis): + TACSQuinticQuadBasis() + +cdef extern from "TACSTriangularBasis.h": + cdef cppclass TACSLinearTriangleBasis(TACSElementBasis): + TACSLinearTriangleBasis() + + cdef cppclass TACSQuadraticTriangleBasis(TACSElementBasis): + TACSQuadraticTriangleBasis() + + cdef cppclass TACSCubicTriangleBasis(TACSElementBasis): + TACSCubicTriangleBasis() + +cdef extern from "TACSHeatConduction.h": + cdef cppclass TACSHeatConduction2D(TACSElementModel): + TACSHeatConduction2D(TACSPlaneStressConstitutive*) + + cdef cppclass TACSHeatConduction3D(TACSElementModel): + TACSHeatConduction3D(TACSSolidConstitutive*) + +cdef extern from "TACSPCMHeatConduction.h": + cdef cppclass TACSPCMHeatConduction2D(TACSElementModel): + TACSPCMHeatConduction2D(TACSPhaseChangeMaterialConstitutive*) + +cdef extern from "TACSLinearElasticity.h": + enum ElementStrainType: + TACS_LINEAR_STRAIN + TACS_NONLINEAR_STRAIN + + cdef cppclass TACSLinearElasticity2D(TACSElementModel): + TACSLinearElasticity2D(TACSPlaneStressConstitutive*, + ElementStrainType) + + cdef cppclass TACSLinearElasticity3D(TACSElementModel): + TACSLinearElasticity3D(TACSSolidConstitutive*, + ElementStrainType) + TACSSolidConstitutive* getConstitutive() + +cdef extern from "TACSThermoelasticity.h": + const int TACS_STEADY_STATE_MECHANICAL + const int TACS_STEADY_STATE_THERMAL + + cdef cppclass TACSLinearThermoelasticity2D(TACSElementModel): + TACSLinearThermoelasticity2D(TACSPlaneStressConstitutive*, + ElementStrainType, int) + + cdef cppclass TACSLinearThermoelasticity3D(TACSElementModel): + TACSLinearThermoelasticity3D(TACSSolidConstitutive*, + ElementStrainType, int) + +cdef extern from "TACSPlateModel.h": + cdef cppclass TACSPlateModel(TACSElementModel): + TACSPlateModel(TACSShellConstitutive*) + +cdef extern from "TACSThermoelasticPlateModel.h": + cdef cppclass TACSThermoelasticPlateModel(TACSElementModel): + TACSThermoelasticPlateModel(TACSShellConstitutive*) + +cdef extern from "TACSElement2D.h": + cdef cppclass TACSElement2D(TACSElement): + TACSElement2D(TACSElementModel*, TACSElementBasis*) + +cdef extern from "TACSElement3D.h": + cdef cppclass TACSElement3D(TACSElement): + TACSElement3D(TACSElementModel*, TACSElementBasis*) + +cdef extern from "TACSTraction2D.h": + cdef cppclass TACSTraction2D(TACSElement): + TACSTraction2D(int, int, TACSElementBasis*, TacsScalar*, int) + +cdef extern from "TACSTraction3D.h": + cdef cppclass TACSTraction3D(TACSElement): + TACSTraction3D(int, int, TACSElementBasis*, TacsScalar*, int) + +cdef extern from "TACSConvectiveTraction2D.h": + cdef cppclass TACSConvectiveTraction2D(TACSElement): + TACSConvectiveTraction2D(int, int, int, TacsScalar, + TacsScalar, + TACSElementBasis*) + +cdef extern from "TACSConvectiveTraction3D.h": + cdef cppclass TACSConvectiveTraction3D(TACSElement): + TACSConvectiveTraction3D(int, int, int, TacsScalar, + TacsScalar, + TACSElementBasis*) + +cdef extern from "TACSShellElementTransform.h": + cdef cppclass TACSShellTransform(TACSObject): + pass + + cdef cppclass TACSShellNaturalTransform(TACSShellTransform): + TACSShellNaturalTransform() + + cdef cppclass TACSShellRefAxisTransform(TACSShellTransform): + TACSShellRefAxisTransform(const TacsScalar*) + void getRefAxis(TacsScalar*) + +cdef extern from "TACSBeamElement.h": + cdef cppclass TACSBeamTransform(TACSObject): + pass + + cdef cppclass TACSBeamRefAxisTransform(TACSBeamTransform): + TACSBeamRefAxisTransform(const TacsScalar*) + void getRefAxis(TacsScalar*) + +cdef extern from "TACSShellElementDefs.h": + cdef cppclass TACSQuad4Shell(TACSElement): + TACSQuad4Shell(TACSShellTransform*, + TACSShellConstitutive*) + + cdef cppclass TACSQuad9Shell(TACSElement): + TACSQuad9Shell(TACSShellTransform*, + TACSShellConstitutive*) + + cdef cppclass TACSQuad16Shell(TACSElement): + TACSQuad16Shell(TACSShellTransform*, + TACSShellConstitutive*) + + cdef cppclass TACSTri3Shell(TACSElement): + TACSTri3Shell(TACSShellTransform*, + TACSShellConstitutive*) + + cdef cppclass TACSQuad4ThermalShell(TACSElement): + TACSQuad4ThermalShell(TACSShellTransform*, + TACSShellConstitutive*) + + cdef cppclass TACSQuad9ThermalShell(TACSElement): + TACSQuad9ThermalShell(TACSShellTransform*, + TACSShellConstitutive*) + + cdef cppclass TACSQuad16ThermalShell(TACSElement): + TACSQuad16ThermalShell(TACSShellTransform*, + TACSShellConstitutive*) + + cdef cppclass TACSTri3ThermalShell(TACSElement): + TACSTri3ThermalShell(TACSShellTransform*, + TACSShellConstitutive*) + + cdef cppclass TACSQuad4NonlinearShell(TACSElement): + TACSQuad4NonlinearShell(TACSShellTransform*, + TACSShellConstitutive*) + + cdef cppclass TACSQuad9NonlinearShell(TACSElement): + TACSQuad9NonlinearShell(TACSShellTransform*, + TACSShellConstitutive*) + + cdef cppclass TACSQuad16NonlinearShell(TACSElement): + TACSQuad16NonlinearShell(TACSShellTransform*, + TACSShellConstitutive*) + + cdef cppclass TACSTri3NonlinearShell(TACSElement): + TACSTri3NonlinearShell(TACSShellTransform*, + TACSShellConstitutive*) + + cdef cppclass TACSQuad4NonlinearThermalShell(TACSElement): + TACSQuad4NonlinearThermalShell(TACSShellTransform*, + TACSShellConstitutive*) + + cdef cppclass TACSQuad9NonlinearThermalShell(TACSElement): + TACSQuad9NonlinearThermalShell(TACSShellTransform*, + TACSShellConstitutive*) + + cdef cppclass TACSQuad16NonlinearThermalShell(TACSElement): + TACSQuad16NonlinearThermalShell(TACSShellTransform*, + TACSShellConstitutive*) + + cdef cppclass TACSTri3NonlinearThermalShell(TACSElement): + TACSTri3NonlinearThermalShell(TACSShellTransform*, + TACSShellConstitutive*) + + cdef cppclass TACSQuad4ShellQuaternion(TACSElement): + TACSQuad4ShellQuaternion(TACSShellTransform*, + TACSShellConstitutive*) + + cdef cppclass TACSQuad4ShellModRot(TACSElement): + TACSQuad4ShellModRot(TACSShellTransform*, + TACSShellConstitutive*) + + cdef cppclass TACSBeam2(TACSElement): + TACSBeam2(TACSBeamTransform*, + TACSBeamConstitutive*) + + cdef cppclass TACSBeam3(TACSElement): + TACSBeam3(TACSBeamTransform*, + TACSBeamConstitutive*) + + cdef cppclass TACSBeam2ModRot(TACSElement): + TACSBeam2ModRot(TACSBeamTransform*, + TACSBeamConstitutive*) + + cdef cppclass TACSBeam3ModRot(TACSElement): + TACSBeam3ModRot(TACSBeamTransform*, + TACSBeamConstitutive*) + + cdef cppclass TACSBeam2Quaternion(TACSElement): + TACSBeam2Quaternion(TACSBeamTransform*, + TACSBeamConstitutive*) + + cdef cppclass TACSBeam3Quaternion(TACSElement): + TACSBeam3Quaternion(TACSBeamTransform*, + TACSBeamConstitutive*) + +cdef extern from "TACSSpringElementTransform.h": + cdef cppclass TACSSpringTransform(TACSObject): + pass + + cdef cppclass TACSSpringIdentityTransform(TACSSpringTransform): + TACSSpringIdentityTransform() + + cdef cppclass TACSSpringRefAxisTransform(TACSSpringTransform): + TACSSpringRefAxisTransform(TacsScalar*) + void getRefAxis(TacsScalar*) + + cdef cppclass TACSSpringRefFrameTransform(TACSSpringTransform): + TACSSpringRefFrameTransform(TacsScalar*, TacsScalar*) + void getRefAxes(TacsScalar*, TacsScalar*) + +cdef extern from "TACSSpringElement.h": + cdef cppclass TACSSpringElement(TACSElement): + TACSSpringElement(TACSSpringTransform*, + TACSGeneralSpringConstitutive*) + +cdef extern from "TACSGibbsVector.h": + cdef cppclass TACSGibbsVector(TACSObject): + TACSGibbsVector(TacsScalar, TacsScalar, TacsScalar) + +cdef extern from "TACSRigidBody.h": + cdef cppclass TACSRefFrame(TACSObject): + TACSRefFrame(TACSGibbsVector*, TACSGibbsVector*, TACSGibbsVector*) + + cdef cppclass TACSRigidBodyViz(TACSObject): + TACSRigidBodyViz(int, int, TacsScalar*, int*, TACSGibbsVector*) + TACSRigidBodyViz(TacsScalar, TacsScalar, TacsScalar) + + cdef cppclass TACSRigidBody(TACSElement): + TACSRigidBody(TACSRefFrame*, const TacsScalar, const TacsScalar*, + const TacsScalar*, TACSGibbsVector*, + TACSGibbsVector*, TACSGibbsVector*, TACSGibbsVector*) + void setDesignVarNums(int, const int*, const int*) + void setVisualization(TACSRigidBodyViz*) + +cdef extern from "TACSKinematicConstraints.h": + cdef cppclass TACSFixedConstraint(TACSElement): + TACSFixedConstraint(TACSRigidBody *bodyA, + TACSGibbsVector *point) + + cdef cppclass TACSSphericalConstraint(TACSElement): + TACSSphericalConstraint(TACSRigidBody *bodyA, TACSRigidBody *bodyB, + TACSGibbsVector *point) + TACSSphericalConstraint(TACSRigidBody *bodyA, + TACSGibbsVector *point) + + cdef cppclass TACSRevoluteConstraint(TACSElement): + TACSRevoluteConstraint(TACSRigidBody *bodyA, TACSRigidBody *bodyB, + TACSGibbsVector *point, TACSGibbsVector *eA) + TACSRevoluteConstraint(TACSRigidBody *bodyA, + TACSGibbsVector *point, TACSGibbsVector *eA) + TACSRevoluteConstraint(int fixed_ref_point, TACSGibbsVector *point, + TACSGibbsVector *eAVec, int inertial_rev_axis) + + cdef cppclass TACSRigidLink(TACSElement): + TACSRigidLink(TACSRigidBody*) + + cdef cppclass TACSRevoluteDriver(TACSElement): + TACSRevoluteDriver(TACSGibbsVector*, TacsScalar) + + cdef cppclass TACSMotionDriver(TACSElement): + TACSMotionDriver(TACSGibbsVector*, TacsScalar, int) + + cdef cppclass TACSAverageConstraint(TACSElement): + TACSAverageConstraint(TACSRigidBody*, TACSGibbsVector*, + TACSRefFrame*, int) + +cdef extern from "TACSRBE2.h": + cdef cppclass TACSRBE2(TACSElement): + TACSRBE2(int, int*) + @staticmethod + void setScalingParameters(double, double) + +cdef extern from "TACSRBE3.h": + cdef cppclass TACSRBE3(TACSElement): + TACSRBE3(int, int*, double*, int*) + @staticmethod + void setScalingParameters(double, double) + +cdef extern from "TACSMassElement.h": + cdef cppclass TACSMassElement(TACSElement): + TACSMassElement(TACSGeneralMassConstitutive*) + +cdef extern from "MITC3.h": + cdef cppclass MITC3(TACSElement): + MITC3(TACSBeamConstitutive *_stiff, + TACSGibbsVector *_gravity, + TACSGibbsVector *_vInit, + TACSGibbsVector *_omegaInit) + +cdef extern from "TACSElementWrapper.h": + cdef cppclass TACSElementWrapper(TACSElement): + TACSElementWrapper(PyObject*, int, int) + + int (*getmultiplierindex)(void*) + void (*getinitconditions)(void*, int, int, const TacsScalar*, int, + TacsScalar*, TacsScalar*, TacsScalar*) + void (*addresidual)(void*, int, double, int, const TacsScalar*, + int, const TacsScalar*, const TacsScalar*, + const TacsScalar*, TacsScalar*) + void (*addjacobian)(void*, int, double, TacsScalar, TacsScalar, TacsScalar, + int, const TacsScalar*, int, const TacsScalar*, + const TacsScalar*, const TacsScalar*, + TacsScalar*, TacsScalar*) diff --git a/tacs/cpp_headers/functions.pxd b/tacs/cpp_headers/functions.pxd new file mode 100644 index 000000000..a3507e1e3 --- /dev/null +++ b/tacs/cpp_headers/functions.pxd @@ -0,0 +1,115 @@ +# This file is part of TACS: The Toolkit for the Analysis of Composite +# Structures, a parallel finite-element code for structural and +# multidisciplinary design optimization. +# +# Copyright (C) 2014 Georgia Tech Research Corporation +# +# TACS is licensed under the Apache License, Version 2.0 (the +# "License"); you may not use this software except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 + +#distutils: language=c++ + +# Import from TACS for definitions +from tacs.cpp_headers.TACS cimport * + +cdef extern from "TACSFunction.h": + enum FunctionDomain: + ENTIRE_DOMAIN + SUB_DOMAIN + NO_DOMAIN + +cdef extern from "TACSStructuralMass.h": + cdef cppclass TACSStructuralMass(TACSFunction): + TACSStructuralMass(TACSAssembler*) + +cdef extern from "TACSEnclosedVolume.h": + cdef cppclass TACSEnclosedVolume(TACSFunction): + TACSEnclosedVolume(TACSAssembler*) + +cdef extern from "TACSCenterOfMass.h": + cdef cppclass TACSCenterOfMass(TACSFunction): + TACSCenterOfMass(TACSAssembler*, const double*) + +cdef extern from "TACSMomentOfInertia.h": + cdef cppclass TACSMomentOfInertia(TACSFunction): + TACSMomentOfInertia(TACSAssembler*, const double*, const double*, int) + +cdef extern from "TACSCompliance.h": + cdef cppclass TACSCompliance(TACSFunction): + TACSCompliance(TACSAssembler*) + void setComplianceType(int) + +cdef extern from "TACSAverageTemperature.h": + cdef cppclass TACSAverageTemperature(TACSFunction): + TACSAverageTemperature(TACSAssembler*, TacsScalar) + +cdef extern from "TACSKSTemperature.h": + enum KSTemperatureType"TACSKTemperature::KSTemperatureType": + KS_TEMPERATURE_DISCRETE"TACSKSTemperature::DISCRETE" + KS_TEMPERATURE_CONTINUOUS"TACSKSTemperature::CONTINUOUS" + PNORM_TEMPERATURE_DISCRETE"TACSKSTemperature::PNORM_DISCRETE" + PNORM_TEMPERATURE_CONTINUOUS"TACSKSTemperature::PNORM_CONTINUOUS" + + cdef cppclass TACSKSTemperature(TACSFunction): + TACSKSTemperature(TACSAssembler*, double, double) + void setKSTemperatureType(KSTemperatureType ftype) + double getParameter() + void setParameter(double) + void setMaxFailOffset(TacsScalar) + +cdef extern from "TACSKSFailure.h": + enum KSFailureType"TACSKFailure::KSFailureType": + KS_FAILURE_DISCRETE"TACSKSFailure::DISCRETE" + KS_FAILURE_CONTINUOUS"TACSKSFailure::CONTINUOUS" + PNORM_FAILURE_DISCRETE"TACSKSFailure::PNORM_DISCRETE" + PNORM_FAILURE_CONTINUOUS"TACSKSFailure::PNORM_CONTINUOUS" + + cdef cppclass TACSKSFailure(TACSFunction): + TACSKSFailure(TACSAssembler*, double, double, double) + void setKSFailureType(KSFailureType ftype) + double getParameter() + void setParameter(double) + void setMaxFailOffset(TacsScalar) + +cdef extern from "TACSKSDisplacement.h": + enum KSDisplacementType"TACSKDisplacement::KSDisplacementType": + KS_DISPLACEMENT_DISCRETE"TACSKSDisplacement::DISCRETE" + KS_DISPLACEMENT_CONTINUOUS"TACSKSDisplacement::CONTINUOUS" + PNORM_DISPLACEMENT_DISCRETE"TACSKSDisplacement::PNORM_DISCRETE" + PNORM_DISPLACEMENT_CONTINUOUS"TACSKSDisplacement::PNORM_CONTINUOUS" + + cdef cppclass TACSKSDisplacement(TACSFunction): + TACSKSDisplacement(TACSAssembler*, double, const double*, double) + void setKSDisplacementType(KSDisplacementType ftype) + double getParameter() + void setParameter(double) + void setMaxDispOffset(TacsScalar) + +cdef extern from "TACSInducedFailure.h": + enum InducedNormType"TACSInducedFailure::InducedNormType": + INDUCED_EXPONENTIAL"TACSInducedFailure::EXPONENTIAL" + INDUCED_POWER"TACSInducedFailure::POWER" + INDUCED_EXPONENTIAL_SQUARED"TACSInducedFailure::EXPONENTIAL_SQUARED" + INDUCED_POWER_SQUARED"TACSInducedFailure::POWER_SQUARED" + INDUCED_DISCRETE_EXPONENTIAL"TACSInducedFailure::DISCRETE_EXPONENTIAL" + INDUCED_DISCRETE_POWER"TACSInducedFailure::DISCRETE_POWER" + INDUCED_DISCRETE_EXPONENTIAL_SQUARED"TACSInducedFailure::DISCRETE_EXPONENTIAL_SQUARED" + INDUCED_DISCRETE_POWER_SQUARED"TACSInducedFailure::DISCRETE_POWER_SQUARED" + + cdef cppclass TACSInducedFailure(TACSFunction): + TACSInducedFailure(TACSAssembler*, double) + void setInducedType(InducedNormType) + void setParameter(double) + double getParameter() + void setMaxFailOffset(TacsScalar _max_fail) + +cdef extern from "TACSHeatFlux.h": + cdef cppclass TACSHeatFlux(TACSFunction): + TACSHeatFlux(TACSAssembler*, int*, int*, int) + +# cdef extern from "TACSDisplacementIntegral.h": +# cdef cppclass TACSDisplacementIntegral(TACSFunction): +# TACSDisplacementIntegral(TACSAssembler *tacs, TacsScalar dir[]) diff --git a/tacs/elements.pxd b/tacs/elements.pxd index f366b1091..e33caea17 100644 --- a/tacs/elements.pxd +++ b/tacs/elements.pxd @@ -12,401 +12,11 @@ #distutils: language=c++ -# Import numpy -from libc.string cimport const_char - -# Import the major python version -from cpython.version cimport PY_MAJOR_VERSION - # Import numpy cimport numpy as np import numpy as np # Import from constitutive for definitions -from constitutive cimport * -from TACS cimport * - -cdef extern from "TACSElementTypes.h": - const int TACS_ELEMENT_DENSITY - const int TACS_STRAIN_ENERGY_DENSITY - const int TACS_FAILURE_INDEX - const int TACS_HEAT_FLUX - const int TACS_TEMPERATURE - const int TACS_TOTAL_STRAIN_ENERGY_DENSITY - const int TACS_ELEMENT_DISPLACEMENT - const int TACS_ELEMENT_STRAIN - const int TACS_ELEMENT_STRESS - -cdef extern from "TACSElementVerification.h": - int TacsTestElementBasisFunctions(TACSElementBasis*, double, int, double, double) - int TacsTestElementBasisFaceNormals(TACSElementBasis*, double, int, double, double) - int TacsTestElementBasisJacobianTransform(TACSElementBasis*, double, int, double, double) - int TacsTestElementBasis(TACSElementBasis*, double, int, double, double) - int TacsTestElementModelJacobian(TACSElementModel*, int, const double, double, int, double, double) - int TacsTestElementModelAdjXptSensProduct(TACSElementModel*, int, const double, double, int, double, double) - int TacsTestElementResidual(TACSElement*, int, double, const TacsScalar*, - const TacsScalar*, const TacsScalar*, - const TacsScalar*, double, int, double, - double) - int TacsTestElementJacobian(TACSElement*, int, double, const TacsScalar*, - const TacsScalar*, const TacsScalar*, - const TacsScalar*, int, double, int, double, - double) - int TacsTestAdjResProduct(TACSElement*, int, double, const TacsScalar*, - const TacsScalar*, const TacsScalar*, const TacsScalar*, - int, const TacsScalar*, double, int, double, double) - int TacsTestAdjResXptProduct(TACSElement*, int, double, const TacsScalar*, - const TacsScalar*, const TacsScalar*, - const TacsScalar*, double, int, double, - double) - int TacsTestElementMatDVSens(TACSElement*, ElementMatrixType, int, double, const TacsScalar*, const TacsScalar*, - int, const TacsScalar*, double, int, double, double) - int TacsTestElementMatXptSens(TACSElement*, ElementMatrixType, int, double, const TacsScalar*, const TacsScalar*, - double, int, double, double) - int TacsTestElementMatSVSens(TACSElement*, ElementMatrixType, int, double, const TacsScalar*, const TacsScalar*, - double, int, double, double) - int TacsSeedRandomGenerator(int) - -cdef extern from "TACSTetrahedralBasis.h": - cdef cppclass TACSLinearTetrahedralBasis(TACSElementBasis): - TACSLinearTetrahedralBasis() - - cdef cppclass TACSQuadraticTetrahedralBasis(TACSElementBasis): - TACSQuadraticTetrahedralBasis() - - cdef cppclass TACSCubicTetrahedralBasis(TACSElementBasis): - TACSCubicTetrahedralBasis() - -cdef extern from "TACSHexaBasis.h": - cdef cppclass TACSLinearHexaBasis(TACSElementBasis): - TACSLinearHexaBasis() - - cdef cppclass TACSQuadraticHexaBasis(TACSElementBasis): - TACSQuadraticHexaBasis() - - cdef cppclass TACSCubicHexaBasis(TACSElementBasis): - TACSCubicHexaBasis() - -cdef extern from "TACSQuadBasis.h": - cdef cppclass TACSLinearQuadBasis(TACSElementBasis): - TACSLinearQuadBasis() - - cdef cppclass TACSQuadraticQuadBasis(TACSElementBasis): - TACSQuadraticQuadBasis() - - cdef cppclass TACSCubicQuadBasis(TACSElementBasis): - TACSCubicQuadBasis() - - cdef cppclass TACSQuarticQuadBasis(TACSElementBasis): - TACSQuarticQuadBasis() - - cdef cppclass TACSQuinticQuadBasis(TACSElementBasis): - TACSQuinticQuadBasis() - -cdef extern from "TACSTriangularBasis.h": - cdef cppclass TACSLinearTriangleBasis(TACSElementBasis): - TACSLinearTriangleBasis() - - cdef cppclass TACSQuadraticTriangleBasis(TACSElementBasis): - TACSQuadraticTriangleBasis() - - cdef cppclass TACSCubicTriangleBasis(TACSElementBasis): - TACSCubicTriangleBasis() - -cdef extern from "TACSHeatConduction.h": - cdef cppclass TACSHeatConduction2D(TACSElementModel): - TACSHeatConduction2D(TACSPlaneStressConstitutive*) - - cdef cppclass TACSHeatConduction3D(TACSElementModel): - TACSHeatConduction3D(TACSSolidConstitutive*) - -cdef extern from "TACSPCMHeatConduction.h": - cdef cppclass TACSPCMHeatConduction2D(TACSElementModel): - TACSPCMHeatConduction2D(TACSPhaseChangeMaterialConstitutive*) - -cdef extern from "TACSLinearElasticity.h": - enum ElementStrainType: - TACS_LINEAR_STRAIN - TACS_NONLINEAR_STRAIN - - cdef cppclass TACSLinearElasticity2D(TACSElementModel): - TACSLinearElasticity2D(TACSPlaneStressConstitutive*, - ElementStrainType) - - cdef cppclass TACSLinearElasticity3D(TACSElementModel): - TACSLinearElasticity3D(TACSSolidConstitutive*, - ElementStrainType) - TACSSolidConstitutive* getConstitutive() - -cdef extern from "TACSThermoelasticity.h": - const int TACS_STEADY_STATE_MECHANICAL - const int TACS_STEADY_STATE_THERMAL - - cdef cppclass TACSLinearThermoelasticity2D(TACSElementModel): - TACSLinearThermoelasticity2D(TACSPlaneStressConstitutive*, - ElementStrainType, int) - - cdef cppclass TACSLinearThermoelasticity3D(TACSElementModel): - TACSLinearThermoelasticity3D(TACSSolidConstitutive*, - ElementStrainType, int) - -cdef extern from "TACSPlateModel.h": - cdef cppclass TACSPlateModel(TACSElementModel): - TACSPlateModel(TACSShellConstitutive*) - -cdef extern from "TACSThermoelasticPlateModel.h": - cdef cppclass TACSThermoelasticPlateModel(TACSElementModel): - TACSThermoelasticPlateModel(TACSShellConstitutive*) - -cdef extern from "TACSElement2D.h": - cdef cppclass TACSElement2D(TACSElement): - TACSElement2D(TACSElementModel*, TACSElementBasis*) - -cdef extern from "TACSElement3D.h": - cdef cppclass TACSElement3D(TACSElement): - TACSElement3D(TACSElementModel*, TACSElementBasis*) - -cdef extern from "TACSTraction2D.h": - cdef cppclass TACSTraction2D(TACSElement): - TACSTraction2D(int, int, TACSElementBasis*, TacsScalar*, int) - -cdef extern from "TACSTraction3D.h": - cdef cppclass TACSTraction3D(TACSElement): - TACSTraction3D(int, int, TACSElementBasis*, TacsScalar*, int) - -cdef extern from "TACSConvectiveTraction2D.h": - cdef cppclass TACSConvectiveTraction2D(TACSElement): - TACSConvectiveTraction2D(int, int, int, TacsScalar, - TacsScalar, - TACSElementBasis*) - -cdef extern from "TACSConvectiveTraction3D.h": - cdef cppclass TACSConvectiveTraction3D(TACSElement): - TACSConvectiveTraction3D(int, int, int, TacsScalar, - TacsScalar, - TACSElementBasis*) - -cdef extern from "TACSShellElementTransform.h": - cdef cppclass TACSShellTransform(TACSObject): - pass - - cdef cppclass TACSShellNaturalTransform(TACSShellTransform): - TACSShellNaturalTransform() - - cdef cppclass TACSShellRefAxisTransform(TACSShellTransform): - TACSShellRefAxisTransform(const TacsScalar*) - void getRefAxis(TacsScalar*) - -cdef extern from "TACSBeamElement.h": - cdef cppclass TACSBeamTransform(TACSObject): - pass - - cdef cppclass TACSBeamRefAxisTransform(TACSBeamTransform): - TACSBeamRefAxisTransform(const TacsScalar*) - void getRefAxis(TacsScalar*) - -cdef extern from "TACSShellElementDefs.h": - cdef cppclass TACSQuad4Shell(TACSElement): - TACSQuad4Shell(TACSShellTransform*, - TACSShellConstitutive*) - - cdef cppclass TACSQuad9Shell(TACSElement): - TACSQuad9Shell(TACSShellTransform*, - TACSShellConstitutive*) - - cdef cppclass TACSQuad16Shell(TACSElement): - TACSQuad16Shell(TACSShellTransform*, - TACSShellConstitutive*) - - cdef cppclass TACSTri3Shell(TACSElement): - TACSTri3Shell(TACSShellTransform*, - TACSShellConstitutive*) - - cdef cppclass TACSQuad4ThermalShell(TACSElement): - TACSQuad4ThermalShell(TACSShellTransform*, - TACSShellConstitutive*) - - cdef cppclass TACSQuad9ThermalShell(TACSElement): - TACSQuad9ThermalShell(TACSShellTransform*, - TACSShellConstitutive*) - - cdef cppclass TACSQuad16ThermalShell(TACSElement): - TACSQuad16ThermalShell(TACSShellTransform*, - TACSShellConstitutive*) - - cdef cppclass TACSTri3ThermalShell(TACSElement): - TACSTri3ThermalShell(TACSShellTransform*, - TACSShellConstitutive*) - - cdef cppclass TACSQuad4NonlinearShell(TACSElement): - TACSQuad4NonlinearShell(TACSShellTransform*, - TACSShellConstitutive*) - - cdef cppclass TACSQuad9NonlinearShell(TACSElement): - TACSQuad9NonlinearShell(TACSShellTransform*, - TACSShellConstitutive*) - - cdef cppclass TACSQuad16NonlinearShell(TACSElement): - TACSQuad16NonlinearShell(TACSShellTransform*, - TACSShellConstitutive*) - - cdef cppclass TACSTri3NonlinearShell(TACSElement): - TACSTri3NonlinearShell(TACSShellTransform*, - TACSShellConstitutive*) - - cdef cppclass TACSQuad4NonlinearThermalShell(TACSElement): - TACSQuad4NonlinearThermalShell(TACSShellTransform*, - TACSShellConstitutive*) - - cdef cppclass TACSQuad9NonlinearThermalShell(TACSElement): - TACSQuad9NonlinearThermalShell(TACSShellTransform*, - TACSShellConstitutive*) - - cdef cppclass TACSQuad16NonlinearThermalShell(TACSElement): - TACSQuad16NonlinearThermalShell(TACSShellTransform*, - TACSShellConstitutive*) - - cdef cppclass TACSTri3NonlinearThermalShell(TACSElement): - TACSTri3NonlinearThermalShell(TACSShellTransform*, - TACSShellConstitutive*) - - cdef cppclass TACSQuad4ShellQuaternion(TACSElement): - TACSQuad4ShellQuaternion(TACSShellTransform*, - TACSShellConstitutive*) - - cdef cppclass TACSQuad4ShellModRot(TACSElement): - TACSQuad4ShellModRot(TACSShellTransform*, - TACSShellConstitutive*) - - cdef cppclass TACSBeam2(TACSElement): - TACSBeam2(TACSBeamTransform*, - TACSBeamConstitutive*) - - cdef cppclass TACSBeam3(TACSElement): - TACSBeam3(TACSBeamTransform*, - TACSBeamConstitutive*) - - cdef cppclass TACSBeam2ModRot(TACSElement): - TACSBeam2ModRot(TACSBeamTransform*, - TACSBeamConstitutive*) - - cdef cppclass TACSBeam3ModRot(TACSElement): - TACSBeam3ModRot(TACSBeamTransform*, - TACSBeamConstitutive*) - - cdef cppclass TACSBeam2Quaternion(TACSElement): - TACSBeam2Quaternion(TACSBeamTransform*, - TACSBeamConstitutive*) - - cdef cppclass TACSBeam3Quaternion(TACSElement): - TACSBeam3Quaternion(TACSBeamTransform*, - TACSBeamConstitutive*) - -cdef extern from "TACSSpringElementTransform.h": - cdef cppclass TACSSpringTransform(TACSObject): - pass - - cdef cppclass TACSSpringIdentityTransform(TACSSpringTransform): - TACSSpringIdentityTransform() - - cdef cppclass TACSSpringRefAxisTransform(TACSSpringTransform): - TACSSpringRefAxisTransform(TacsScalar*) - void getRefAxis(TacsScalar*) - - cdef cppclass TACSSpringRefFrameTransform(TACSSpringTransform): - TACSSpringRefFrameTransform(TacsScalar*, TacsScalar*) - void getRefAxes(TacsScalar*, TacsScalar*) - -cdef extern from "TACSSpringElement.h": - cdef cppclass TACSSpringElement(TACSElement): - TACSSpringElement(TACSSpringTransform*, - TACSGeneralSpringConstitutive*) - -cdef extern from "TACSGibbsVector.h": - cdef cppclass TACSGibbsVector(TACSObject): - TACSGibbsVector(TacsScalar, TacsScalar, TacsScalar) - -cdef extern from "TACSRigidBody.h": - cdef cppclass TACSRefFrame(TACSObject): - TACSRefFrame(TACSGibbsVector*, TACSGibbsVector*, TACSGibbsVector*) - - cdef cppclass TACSRigidBodyViz(TACSObject): - TACSRigidBodyViz(int, int, TacsScalar*, int*, TACSGibbsVector*) - TACSRigidBodyViz(TacsScalar, TacsScalar, TacsScalar) - - cdef cppclass TACSRigidBody(TACSElement): - TACSRigidBody(TACSRefFrame*, const TacsScalar, const TacsScalar*, - const TacsScalar*, TACSGibbsVector*, - TACSGibbsVector*, TACSGibbsVector*, TACSGibbsVector*) - void setDesignVarNums(int, const int*, const int*) - void setVisualization(TACSRigidBodyViz*) - -cdef extern from "TACSKinematicConstraints.h": - cdef cppclass TACSFixedConstraint(TACSElement): - TACSFixedConstraint(TACSRigidBody *bodyA, - TACSGibbsVector *point) - - cdef cppclass TACSSphericalConstraint(TACSElement): - TACSSphericalConstraint(TACSRigidBody *bodyA, TACSRigidBody *bodyB, - TACSGibbsVector *point) - TACSSphericalConstraint(TACSRigidBody *bodyA, - TACSGibbsVector *point) - - cdef cppclass TACSRevoluteConstraint(TACSElement): - TACSRevoluteConstraint(TACSRigidBody *bodyA, TACSRigidBody *bodyB, - TACSGibbsVector *point, TACSGibbsVector *eA) - TACSRevoluteConstraint(TACSRigidBody *bodyA, - TACSGibbsVector *point, TACSGibbsVector *eA) - TACSRevoluteConstraint(int fixed_ref_point, TACSGibbsVector *point, - TACSGibbsVector *eAVec, int inertial_rev_axis) - - cdef cppclass TACSRigidLink(TACSElement): - TACSRigidLink(TACSRigidBody*) - - cdef cppclass TACSRevoluteDriver(TACSElement): - TACSRevoluteDriver(TACSGibbsVector*, TacsScalar) - - cdef cppclass TACSMotionDriver(TACSElement): - TACSMotionDriver(TACSGibbsVector*, TacsScalar, int) - - cdef cppclass TACSAverageConstraint(TACSElement): - TACSAverageConstraint(TACSRigidBody*, TACSGibbsVector*, - TACSRefFrame*, int) - -cdef extern from "TACSRBE2.h": - cdef cppclass TACSRBE2(TACSElement): - TACSRBE2(int, int*) - @staticmethod - void setScalingParameters(double, double) - -cdef extern from "TACSRBE3.h": - cdef cppclass TACSRBE3(TACSElement): - TACSRBE3(int, int*, double*, int*) - @staticmethod - void setScalingParameters(double, double) - -cdef extern from "TACSMassElement.h": - cdef cppclass TACSMassElement(TACSElement): - TACSMassElement(TACSGeneralMassConstitutive*) - -cdef extern from "MITC3.h": - cdef cppclass MITC3(TACSElement): - MITC3(TACSBeamConstitutive *_stiff, - TACSGibbsVector *_gravity, - TACSGibbsVector *_vInit, - TACSGibbsVector *_omegaInit) - -cdef extern from "TACSElementWrapper.h": - cdef cppclass TACSElementWrapper(TACSElement): - TACSElementWrapper(PyObject*, int, int) - - int (*getmultiplierindex)(void*) - void (*getinitconditions)(void*, int, int, const TacsScalar*, int, - TacsScalar*, TacsScalar*, TacsScalar*) - void (*addresidual)(void*, int, double, int, const TacsScalar*, - int, const TacsScalar*, const TacsScalar*, - const TacsScalar*, TacsScalar*) - void (*addjacobian)(void*, int, double, TacsScalar, TacsScalar, TacsScalar, - int, const TacsScalar*, int, const TacsScalar*, - const TacsScalar*, const TacsScalar*, - TacsScalar*, TacsScalar*) +from tacs.cpp_headers.constitutive cimport * +from tacs.cpp_headers.TACS cimport * +from tacs.cpp_headers.elements cimport * diff --git a/tacs/elements.pyx b/tacs/elements.pyx index 5c0c855d5..7cfc886ae 100644 --- a/tacs/elements.pyx +++ b/tacs/elements.pyx @@ -34,9 +34,8 @@ from cpython cimport PyObject, Py_INCREF include "TacsDefs.pxi" # Import the definitions -from TACS cimport * -from constitutive cimport * -from elements cimport * +from tacs.TACS cimport * +from tacs.constitutive cimport * # Include the mpi4py header cdef extern from "mpi-compat.h": diff --git a/tacs/functions.pxd b/tacs/functions.pxd index fd46a6ab4..b6a8a76ee 100644 --- a/tacs/functions.pxd +++ b/tacs/functions.pxd @@ -12,113 +12,6 @@ #distutils: language=c++ -# For MPI capabilities -from mpi4py.libmpi cimport * -cimport mpi4py.MPI as MPI - -# Import numpy -import numpy as np -cimport numpy as np -from libc.string cimport const_char - # Import from TACS for definitions -from TACS cimport * - -cdef extern from "TACSFunction.h": - enum FunctionDomain: - ENTIRE_DOMAIN - SUB_DOMAIN - NO_DOMAIN - -cdef extern from "TACSStructuralMass.h": - cdef cppclass TACSStructuralMass(TACSFunction): - TACSStructuralMass(TACSAssembler*) - -cdef extern from "TACSEnclosedVolume.h": - cdef cppclass TACSEnclosedVolume(TACSFunction): - TACSEnclosedVolume(TACSAssembler*) - -cdef extern from "TACSCenterOfMass.h": - cdef cppclass TACSCenterOfMass(TACSFunction): - TACSCenterOfMass(TACSAssembler*, const double*) - -cdef extern from "TACSMomentOfInertia.h": - cdef cppclass TACSMomentOfInertia(TACSFunction): - TACSMomentOfInertia(TACSAssembler*, const double*, const double*, int) - -cdef extern from "TACSCompliance.h": - cdef cppclass TACSCompliance(TACSFunction): - TACSCompliance(TACSAssembler*) - void setComplianceType(int) - -cdef extern from "TACSAverageTemperature.h": - cdef cppclass TACSAverageTemperature(TACSFunction): - TACSAverageTemperature(TACSAssembler*, TacsScalar) - -cdef extern from "TACSKSTemperature.h": - enum KSTemperatureType"TACSKTemperature::KSTemperatureType": - KS_TEMPERATURE_DISCRETE"TACSKSTemperature::DISCRETE" - KS_TEMPERATURE_CONTINUOUS"TACSKSTemperature::CONTINUOUS" - PNORM_TEMPERATURE_DISCRETE"TACSKSTemperature::PNORM_DISCRETE" - PNORM_TEMPERATURE_CONTINUOUS"TACSKSTemperature::PNORM_CONTINUOUS" - - cdef cppclass TACSKSTemperature(TACSFunction): - TACSKSTemperature(TACSAssembler*, double, double) - void setKSTemperatureType(KSTemperatureType ftype) - double getParameter() - void setParameter(double) - void setMaxFailOffset(TacsScalar) - -cdef extern from "TACSKSFailure.h": - enum KSFailureType"TACSKFailure::KSFailureType": - KS_FAILURE_DISCRETE"TACSKSFailure::DISCRETE" - KS_FAILURE_CONTINUOUS"TACSKSFailure::CONTINUOUS" - PNORM_FAILURE_DISCRETE"TACSKSFailure::PNORM_DISCRETE" - PNORM_FAILURE_CONTINUOUS"TACSKSFailure::PNORM_CONTINUOUS" - - cdef cppclass TACSKSFailure(TACSFunction): - TACSKSFailure(TACSAssembler*, double, double, double) - void setKSFailureType(KSFailureType ftype) - double getParameter() - void setParameter(double) - void setMaxFailOffset(TacsScalar) - -cdef extern from "TACSKSDisplacement.h": - enum KSDisplacementType"TACSKDisplacement::KSDisplacementType": - KS_DISPLACEMENT_DISCRETE"TACSKSDisplacement::DISCRETE" - KS_DISPLACEMENT_CONTINUOUS"TACSKSDisplacement::CONTINUOUS" - PNORM_DISPLACEMENT_DISCRETE"TACSKSDisplacement::PNORM_DISCRETE" - PNORM_DISPLACEMENT_CONTINUOUS"TACSKSDisplacement::PNORM_CONTINUOUS" - - cdef cppclass TACSKSDisplacement(TACSFunction): - TACSKSDisplacement(TACSAssembler*, double, const double*, double) - void setKSDisplacementType(KSDisplacementType ftype) - double getParameter() - void setParameter(double) - void setMaxDispOffset(TacsScalar) - -cdef extern from "TACSInducedFailure.h": - enum InducedNormType"TACSInducedFailure::InducedNormType": - INDUCED_EXPONENTIAL"TACSInducedFailure::EXPONENTIAL" - INDUCED_POWER"TACSInducedFailure::POWER" - INDUCED_EXPONENTIAL_SQUARED"TACSInducedFailure::EXPONENTIAL_SQUARED" - INDUCED_POWER_SQUARED"TACSInducedFailure::POWER_SQUARED" - INDUCED_DISCRETE_EXPONENTIAL"TACSInducedFailure::DISCRETE_EXPONENTIAL" - INDUCED_DISCRETE_POWER"TACSInducedFailure::DISCRETE_POWER" - INDUCED_DISCRETE_EXPONENTIAL_SQUARED"TACSInducedFailure::DISCRETE_EXPONENTIAL_SQUARED" - INDUCED_DISCRETE_POWER_SQUARED"TACSInducedFailure::DISCRETE_POWER_SQUARED" - - cdef cppclass TACSInducedFailure(TACSFunction): - TACSInducedFailure(TACSAssembler*, double) - void setInducedType(InducedNormType) - void setParameter(double) - double getParameter() - void setMaxFailOffset(TacsScalar _max_fail) - -cdef extern from "TACSHeatFlux.h": - cdef cppclass TACSHeatFlux(TACSFunction): - TACSHeatFlux(TACSAssembler*, int*, int*, int) - -# cdef extern from "TACSDisplacementIntegral.h": -# cdef cppclass TACSDisplacementIntegral(TACSFunction): -# TACSDisplacementIntegral(TACSAssembler *tacs, TacsScalar dir[]) +from tacs.cpp_headers.TACS cimport * +from tacs.cpp_headers.functions cimport * diff --git a/tacs/functions.pyx b/tacs/functions.pyx index 2db803349..13c022e54 100644 --- a/tacs/functions.pyx +++ b/tacs/functions.pyx @@ -31,8 +31,7 @@ from libc.stdlib cimport malloc, free from cpython cimport PyObject, Py_INCREF # Import the definitions -from TACS cimport * -from functions cimport * +from tacs.TACS cimport * # Include the definitions include "TacsDefs.pxi" From 619c4bf6eb63567925d2e077da8765d7bcf13fd7 Mon Sep 17 00:00:00 2001 From: Tim Brooks <41971846+timryanb@users.noreply.github.com> Date: Wed, 19 Jul 2023 17:34:23 -0400 Subject: [PATCH 2/7] Fixing minor omissions --- Makefile | 4 ++-- tacs/elements.pyx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index ee64eb27c..f2006a24a 100644 --- a/Makefile +++ b/Makefile @@ -60,11 +60,11 @@ debug: fi ${CXX} ${SO_LINK_FLAGS} ${TACS_OBJS} ${TACS_EXTERN_LIBS} -o ${TACS_DIR}/lib/libtacs.${SO_EXT} @if [ "${TACS_IS_COMPLEX}" = "true" ]; then \ - echo "ctypedef complex TacsScalar" > tacs/TacsTypedefs.pxi; \ + echo "ctypedef complex TacsScalar" > tacs/cpp_headers/TacsTypedefs.pxi; \ echo "TACS_NPY_SCALAR = np.NPY_CDOUBLE" > tacs/TacsDefs.pxi; \ echo "dtype = complex" >> tacs/TacsDefs.pxi; \ else \ - echo "ctypedef double TacsScalar" > tacs/TacsTypedefs.pxi; \ + echo "ctypedef double TacsScalar" > tacs/cpp_headers/TacsTypedefs.pxi; \ echo "TACS_NPY_SCALAR = np.NPY_DOUBLE" > tacs/TacsDefs.pxi; \ echo "dtype = np.double" >> tacs/TacsDefs.pxi; \ fi diff --git a/tacs/elements.pyx b/tacs/elements.pyx index 7cfc886ae..eba473dc9 100644 --- a/tacs/elements.pyx +++ b/tacs/elements.pyx @@ -1425,7 +1425,7 @@ cdef class RBE2(Element): cdef TACSRBE2 *cptr def __cinit__(self, int num_nodes, np.ndarray[int, ndim=1, mode='c'] constrained_dofs): - num_dep = (num_nodes - 1) / 2 + num_dep = (num_nodes - 1) // 2 assert len(constrained_dofs) == 6 or len(constrained_dofs) == 6 * num_dep From 61ddb80947ba80acdcde65256053223336716461 Mon Sep 17 00:00:00 2001 From: Tim Brooks <41971846+timryanb@users.noreply.github.com> Date: Wed, 19 Jul 2023 17:47:19 -0400 Subject: [PATCH 3/7] Fixing issue w/ int in rbe2 wrapper --- tacs/elements.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tacs/elements.pyx b/tacs/elements.pyx index eba473dc9..122516044 100644 --- a/tacs/elements.pyx +++ b/tacs/elements.pyx @@ -1425,7 +1425,7 @@ cdef class RBE2(Element): cdef TACSRBE2 *cptr def __cinit__(self, int num_nodes, np.ndarray[int, ndim=1, mode='c'] constrained_dofs): - num_dep = (num_nodes - 1) // 2 + cdef int num_dep = (num_nodes - 1) // 2 assert len(constrained_dofs) == 6 or len(constrained_dofs) == 6 * num_dep @@ -1479,7 +1479,7 @@ cdef class RBE3(Element): np.ndarray[int, ndim=1, mode='c'] dep_constrained_dofs, np.ndarray[double, ndim=1, mode='c'] weights, np.ndarray[int, ndim=1, mode='c'] indep_constrained_dofs): - num_indep = num_nodes - 2 + cdef int num_indep = num_nodes - 2 assert len(dep_constrained_dofs) == 6 assert len(weights) == 1 or len(weights) == num_indep From 9eeed0f25f0f55f251adf511acae6ceecd29764c Mon Sep 17 00:00:00 2001 From: Tim Brooks <41971846+timryanb@users.noreply.github.com> Date: Wed, 19 Jul 2023 18:18:57 -0400 Subject: [PATCH 4/7] Bumping cython build lower bound to 3.0.0 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 35ddd5e42..2522b08cb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ #pyproject.toml [build-system] # Minimum requirements for the build system to execute. -requires = ['setuptools>=45.0', 'wheel', 'cython>=0.29', 'oldest-supported-numpy', +requires = ['setuptools>=45.0', 'wheel', 'cython>=3.0.0', 'oldest-supported-numpy', # Build against an old version (3.1.1) of mpi4py for forward compatibility "mpi4py==3.1.1; python_version<'3.11'", # Python 3.11 requires 3.1.4+ From d58485894dd19737ea3194610dab610c2ceeb917 Mon Sep 17 00:00:00 2001 From: Tim Brooks <41971846+timryanb@users.noreply.github.com> Date: Fri, 21 Jul 2023 11:12:06 -0400 Subject: [PATCH 5/7] Update cython req in conda meta.yaml --- conda/meta.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conda/meta.yaml b/conda/meta.yaml index f94fcebb5..13859a3e2 100644 --- a/conda/meta.yaml +++ b/conda/meta.yaml @@ -57,7 +57,7 @@ requirements: - metis >=5.1 - tecio - mpi4py - - cython >=0.29,<3.0 + - cython >=3.0.0 - setuptools run: From 90b15365b8213e8c4dd57ed6e8f46720e8899bac Mon Sep 17 00:00:00 2001 From: Tim Brooks <41971846+timryanb@users.noreply.github.com> Date: Fri, 28 Jul 2023 09:50:49 -0400 Subject: [PATCH 6/7] Moving smeared composite header to cython header files --- tacs/constitutive.pxd | 66 ------------------------------- tacs/cpp_headers/constitutive.pxd | 66 +++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 66 deletions(-) diff --git a/tacs/constitutive.pxd b/tacs/constitutive.pxd index 4c1396f01..6c244ca22 100644 --- a/tacs/constitutive.pxd +++ b/tacs/constitutive.pxd @@ -41,72 +41,6 @@ cdef class SolidConstitutive(Constitutive): cdef class ShellConstitutive(Constitutive): cdef TACSShellConstitutive *cptr -cdef extern from "TACSIsoShellConstitutive.h": - cdef cppclass TACSIsoShellConstitutive(TACSShellConstitutive): - TACSIsoShellConstitutive(TACSMaterialProperties*, TacsScalar, int, - TacsScalar, TacsScalar) - -cdef extern from "TACSCompositeShellConstitutive.h": - cdef cppclass TACSCompositeShellConstitutive(TACSShellConstitutive): - TACSCompositeShellConstitutive(int, TACSOrthotropicPly**, const TacsScalar*, - const TacsScalar*, TacsScalar) - void getPlyThicknesses(TacsScalar*); - void getPlyAngles(TacsScalar*); - -cdef extern from "TACSSmearedCompositeShellConstitutive.h": - cdef cppclass TACSSmearedCompositeShellConstitutive(TACSShellConstitutive): - TACSSmearedCompositeShellConstitutive(int, TACSOrthotropicPly**, TacsScalar, - const TacsScalar*, const TacsScalar*, - int, const int*, - TacsScalar, TacsScalar, - const TacsScalar*, const TacsScalar*) - TacsScalar getLaminateThickness(); - void getPlyAngles(TacsScalar*); - void getPlyFractions(TacsScalar *); - -cdef extern from "TACSLamParamShellConstitutive.h": - cdef cppclass TACSLamParamShellConstitutive(TACSShellConstitutive): - TACSLamParamShellConstitutive(TACSOrthotropicPly*, TacsScalar, int, TacsScalar, TacsScalar, - TacsScalar, TacsScalar, TacsScalar, int, int, int, - TacsScalar, TacsScalar, TacsScalar, - TacsScalar, TacsScalar, int, int, TacsScalar, TacsScalar) - -cdef extern from "TACSBladeStiffenedShellConstitutive.h": - cdef cppclass TACSBladeStiffenedShellConstitutive(TACSShellConstitutive): - TACSBladeStiffenedShellConstitutive( - TACSOrthotropicPly*, # panelPly - TACSOrthotropicPly*, # stiffenerPly - TacsScalar, # kcorr - TacsScalar, # panelLength - int, # panelLengthNum - TacsScalar, # stiffenerPitch - int, # stiffenerPitchNum - TacsScalar, # panelThick - int, # panelThickNum - int, # numPanelPlies - TacsScalar[], # panelPlyAngles - TacsScalar[], # panelPlyFracs - int[], # panelPlyFracNums - TacsScalar, # stiffenerHeight - int, # stiffenerHeightNum - TacsScalar, # stiffenerThick - int, # stiffenerThickNum - int, # numStiffenerPlies - TacsScalar[], # stiffenerPlyAngles - TacsScalar[], # stiffenerPlyFracs - int[], # stiffenerPlyFracNums - TacsScalar # flangeFraction - ) - int getNumPanelPlies() - int getNumStiffenerPlies() - void setKSWeight(double ksWeight) - void setStiffenerPitchBounds(TacsScalar lowerBound, TacsScalar upperBound) - void setStiffenerHeightBounds(TacsScalar lowerBound, TacsScalar upperBound) - void setStiffenerThicknessBounds(TacsScalar lowerBound, TacsScalar upperBound) - void setPanelThicknessBounds(TacsScalar lowerBound, TacsScalar upperBound) - void setStiffenerPlyFractionBounds(TacsScalar[] lowerBound, TacsScalar[] upperBound) - void setPanelPlyFractionBounds(TacsScalar[] lowerBound, TacsScalar[] upperBound) - cdef class BladeStiffenedShellConstitutive(ShellConstitutive): cdef TACSBladeStiffenedShellConstitutive *blade_ptr diff --git a/tacs/cpp_headers/constitutive.pxd b/tacs/cpp_headers/constitutive.pxd index bf147a3fd..5aba076f5 100644 --- a/tacs/cpp_headers/constitutive.pxd +++ b/tacs/cpp_headers/constitutive.pxd @@ -95,6 +95,72 @@ cdef extern from "TACSLamParamShellConstitutive.h": TacsScalar, TacsScalar, TacsScalar, TacsScalar, TacsScalar, int, int, TacsScalar, TacsScalar) +cdef extern from "TACSIsoShellConstitutive.h": + cdef cppclass TACSIsoShellConstitutive(TACSShellConstitutive): + TACSIsoShellConstitutive(TACSMaterialProperties*, TacsScalar, int, + TacsScalar, TacsScalar) + +cdef extern from "TACSCompositeShellConstitutive.h": + cdef cppclass TACSCompositeShellConstitutive(TACSShellConstitutive): + TACSCompositeShellConstitutive(int, TACSOrthotropicPly**, const TacsScalar*, + const TacsScalar*, TacsScalar) + void getPlyThicknesses(TacsScalar*); + void getPlyAngles(TacsScalar*); + +cdef extern from "TACSSmearedCompositeShellConstitutive.h": + cdef cppclass TACSSmearedCompositeShellConstitutive(TACSShellConstitutive): + TACSSmearedCompositeShellConstitutive(int, TACSOrthotropicPly**, TacsScalar, + const TacsScalar*, const TacsScalar*, + int, const int*, + TacsScalar, TacsScalar, + const TacsScalar*, const TacsScalar*) + TacsScalar getLaminateThickness(); + void getPlyAngles(TacsScalar*); + void getPlyFractions(TacsScalar *); + +cdef extern from "TACSLamParamShellConstitutive.h": + cdef cppclass TACSLamParamShellConstitutive(TACSShellConstitutive): + TACSLamParamShellConstitutive(TACSOrthotropicPly*, TacsScalar, int, TacsScalar, TacsScalar, + TacsScalar, TacsScalar, TacsScalar, int, int, int, + TacsScalar, TacsScalar, TacsScalar, + TacsScalar, TacsScalar, int, int, TacsScalar, TacsScalar) + +cdef extern from "TACSBladeStiffenedShellConstitutive.h": + cdef cppclass TACSBladeStiffenedShellConstitutive(TACSShellConstitutive): + TACSBladeStiffenedShellConstitutive( + TACSOrthotropicPly*, # panelPly + TACSOrthotropicPly*, # stiffenerPly + TacsScalar, # kcorr + TacsScalar, # panelLength + int, # panelLengthNum + TacsScalar, # stiffenerPitch + int, # stiffenerPitchNum + TacsScalar, # panelThick + int, # panelThickNum + int, # numPanelPlies + TacsScalar[], # panelPlyAngles + TacsScalar[], # panelPlyFracs + int[], # panelPlyFracNums + TacsScalar, # stiffenerHeight + int, # stiffenerHeightNum + TacsScalar, # stiffenerThick + int, # stiffenerThickNum + int, # numStiffenerPlies + TacsScalar[], # stiffenerPlyAngles + TacsScalar[], # stiffenerPlyFracs + int[], # stiffenerPlyFracNums + TacsScalar # flangeFraction + ) + int getNumPanelPlies() + int getNumStiffenerPlies() + void setKSWeight(double ksWeight) + void setStiffenerPitchBounds(TacsScalar lowerBound, TacsScalar upperBound) + void setStiffenerHeightBounds(TacsScalar lowerBound, TacsScalar upperBound) + void setStiffenerThicknessBounds(TacsScalar lowerBound, TacsScalar upperBound) + void setPanelThicknessBounds(TacsScalar lowerBound, TacsScalar upperBound) + void setStiffenerPlyFractionBounds(TacsScalar[] lowerBound, TacsScalar[] upperBound) + void setPanelPlyFractionBounds(TacsScalar[] lowerBound, TacsScalar[] upperBound) + cdef extern from "TACSBladeStiffenedShellConstitutive.h": cdef cppclass TACSBladeStiffenedShellConstitutive(TACSShellConstitutive): TACSBladeStiffenedShellConstitutive( From 4328e960d7d587b9c6fe668e8efa9b93fa831ada Mon Sep 17 00:00:00 2001 From: Tim Brooks <41971846+timryanb@users.noreply.github.com> Date: Fri, 28 Jul 2023 10:08:48 -0400 Subject: [PATCH 7/7] Remove debug printing for smeared composite test --- .../test_smeared_composite_shell_constitutive.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/constitutive_tests/test_smeared_composite_shell_constitutive.py b/tests/constitutive_tests/test_smeared_composite_shell_constitutive.py index d0dda3406..095680992 100644 --- a/tests/constitutive_tests/test_smeared_composite_shell_constitutive.py +++ b/tests/constitutive_tests/test_smeared_composite_shell_constitutive.py @@ -18,7 +18,7 @@ def setUp(self): # Basically, only check relative tolerance self.atol = np.clip(1e-5 * self.rtol, 1e-14, 1e-8) - self.print_level = 2 + self.print_level = 0 # Set element index self.elem_index = 0