#include "cpa_std.h" #include "MEC/mecmatca.h" #include "MEC/dnmldmat.h" #include "MEC/dnmlkmat.h" #include "DPT.h" #include "GEO.h" /* Fills in a MecMatCharacteristics */ /* Private method */ /* Author : JM Soudagne */ /* Date : 1997-04-01 */ /* Version : 1.00 */ /* Modify : yyyy-mm-dd */ SCR_tde_Anl_ReturnValue fn_eScriptFillMecMatCharacteristics( DNM_tdxHandleToMecMatCharacteristics _h_MecEnvironment, char *_p_szName, char *_ap_szPars[], SCR_tde_Anl_Action _eAction ) { SCR_tde_Anl_ReturnValue eReturnValue = SCR_ERV_Anl_NormalReturn; double dfTmp; DNM_tdstMecMatCharacteristics *p_stMecMatCharacteristics; p_stMecMatCharacteristics = DNM_fn_p_stMecMatCharacteristicsGiveBackSemantic(_h_MecEnvironment); if(strcmp(_p_szName,C_EntrySlide) == 0){ /* slide */ dfTmp = atof(_ap_szPars[0]); DNM_M_xMatCharacteristicsSetSlide(p_stMecMatCharacteristics,MTH_M_xDoubleToReal(dfTmp)); } else if(strcmp(_p_szName,C_EntryRebound) == 0){ /* rebound */ dfTmp = atof(_ap_szPars[0]); DNM_M_xMatCharacteristicsSetRebound(p_stMecMatCharacteristics,MTH_M_xDoubleToReal(dfTmp)); } return(eReturnValue); } /* Reads the script file describing a MecMatCharacteristics */ /* Author : JM Soudagne */ /* Date : 1997-04-01 */ /* Version : 1.00 */ /* Modify : 1997-05-14 */ /* Add of complete name in link table */ SCR_tde_Anl_ReturnValue fn_eScriptCallBackMecMatCharacteristics( SCR_tdst_File_Description *_p_stFile, char *_p_szName, char *_ap_szPars[], SCR_tde_Anl_Action _eAction) { DNM_tdxHandleToMecMatCharacteristics hMecMatCharacteristics; SCR_tde_Anl_ReturnValue eReturnValue = SCR_ERV_Anl_NormalReturn; char szLinkTableKey[_MAX_PATH]; if(_eAction==SCR_EA_Anl_BeginSection) { /* If a section is detected */ hMecMatCharacteristics = DNM_fn_xMatCharacteristicsCreate(); SCR_M_RdL0_SetSectionLong(0,0,(unsigned long)(hMecMatCharacteristics)); strcpy(szLinkTableKey,SCR_M_RdL0_GetCompleteSectionNameR(0)); DNM_fn_vSetValueInLinkTableOfMecMatCharacteristics(szLinkTableKey,(unsigned long)(hMecMatCharacteristics)); } else if(_eAction==SCR_EA_Anl_Entry) { /* Fills the MecMatCharacteristics */ SCR_M_RdL0_GetSectionLong(0,0,DNM_tdxHandleToMecMatCharacteristics,hMecMatCharacteristics); fn_eScriptFillMecMatCharacteristics(hMecMatCharacteristics, _p_szName, _ap_szPars, _eAction); } return(eReturnValue); } /* Init the load of mechanical material */ /* Author : JM Soudagne */ /* Date : 1997-04-01 */ /* Version : 1.00 */ /* Modify : yyyy-mm-dd */ void DNM_fn_vInitLoadMecMatCharacteristics() { SCR_fn_v_RdL0_RegisterCallback( C_SectionMecMatCharacteristics, fn_eScriptCallBackMecMatCharacteristics, SCR_CRC_c_RdL0_ForSection ); } /*---------------------------------------------------------------------------- // Description : DNM_fn_ulWriteMMTBinaryBloc //---------------------------------------------------------------------------- // Methods : Write the binary bloc for the mecanical material //---------------------------------------------------------------------------- // Input : _ulStructAdress : Address of the structure to be written // _p_cDestBuffer : Output buffer // Output : The length of the data written //---------------------------------------------------------------------------- // Creation date : Aug 97 Author: Alain Robin //---------------------------------------------------------------------------- // Modifications : // Modification date : Modification author : ----------------------------------------------------------------------------*/ /* unsigned long DNM_fn_ulWriteMMTBinaryBloc(unsigned long _ulStructAdress, char* _p_cDestBuffer) { char* p_cBufferPointer=_p_cDestBuffer; DNM_tdstMecMatCharacteristics* p_stMecMat; p_stMecMat=(DNM_tdstMecMatCharacteristics*)_ulStructAdress; p_cBufferPointer=BIN_fn_p_cPutReal(p_cBufferPointer,p_stMecMat->m_xSlide); p_cBufferPointer=BIN_fn_p_cPutReal(p_cBufferPointer,p_stMecMat->m_xRebound); return p_cBufferPointer-_p_cDestBuffer; } */ /*---------------------------------------------------------------------------- // Description : DNM_fn_vWriteAllMMTBinaryBlocs //---------------------------------------------------------------------------- // Methods : Write all the binary bloc for the mecanical material //---------------------------------------------------------------------------- // Input : _szBinaryFileName // Output : //---------------------------------------------------------------------------- // Creation date : Aug 97 Author: Alain Robin //---------------------------------------------------------------------------- // Modifications : // Modification date : Modification author : ----------------------------------------------------------------------------*/ /* void DNM_fn_vWriteAllMMTBinaryBlocs(char* _szBinaryFileName) { DNM_fn_vPrepareSaveMaterialBinaryBloc(); BIN_fn_vPutBinaryDataIntoFileFromLinkTable(_szBinaryFileName,DNM_fn_p_stGetLinkTableOfMecMatCharacteristics(), sizeof(DNM_tdstMecMatCharacteristics),DNM_fn_ulWriteMMTBinaryBloc); } */ /*---------------------------------------------------------------------------- // Description : DNM_fn_ulReadMMTBinaryBloc //---------------------------------------------------------------------------- // Methods : Read a the binary bloc for the mecanical material //---------------------------------------------------------------------------- // Input : _p_cLoadedBuffer : Input buffer // _ulLoadedBufferSize : Size of the loaded buffer // Output : The address of the allocated bloc //---------------------------------------------------------------------------- // Creation date : Aug 97 Author: Alain Robin //---------------------------------------------------------------------------- // Modifications : // Modification date : Modification author : ----------------------------------------------------------------------------*/ /* unsigned long DNM_fn_ulReadMMTBinaryBloc(char* _p_cLoadedBuffer,unsigned long _ulLoadedBufferSize) { DNM_tdxHandleToMecMatCharacteristics hNewMecMaterial=NULL; hNewMecMaterial = DNM_fn_xMatCharacteristicsCreate(); memcpy((char*)hNewMecMaterial,_p_cLoadedBuffer,_ulLoadedBufferSize); return (unsigned long)hNewMecMaterial; } */ /*---------------------------------------------------------------------------- // Description : DNM_fn_vReadAllMMTBinaryBlocs //---------------------------------------------------------------------------- // Methods : Read all the binary blocs for the mecanical material //---------------------------------------------------------------------------- // Input : _szBinaryFileName : The binary file name // Output : //---------------------------------------------------------------------------- // Creation date : Aug 97 Author: Alain Robin //---------------------------------------------------------------------------- // Modifications : // Modification date : Modification author : ----------------------------------------------------------------------------*/ /* void DNM_fn_vReadAllMMTBinaryBlocs(char* _szBinaryFileName) { BIN_fn_vReadDataFromLinkTable(DNM_fn_p_stGetLinkTableOfMecMatCharacteristics(),DNM_fn_ulReadMMTBinaryBloc, sizeof(DNM_tdstMecMatCharacteristics), _szBinaryFileName); } char* DNM_fn_p_cGeneralAllocateFunction(unsigned long _ulSize) { char* p_cBuffer; GEO_M_CPAMalloc(p_cBuffer,char*,_ulSize,E_uwGEONotEnoughtMemory); return p_cBuffer; } */ /*---------------------------------------------------------------------------- // Description : DNM_fn_vReadAllMMTBinaryBlocs2 //---------------------------------------------------------------------------- // Methods : Read all the binary blocs for the mecanical material //---------------------------------------------------------------------------- // Input : _szBinaryFileName : The binary file name // Output : //---------------------------------------------------------------------------- // Creation date : Aug 97 Author: Alain Robin //---------------------------------------------------------------------------- // Modifications : // Modification date : Modification author : ----------------------------------------------------------------------------*/ /* void DNM_fn_vReadAllMMTBinaryBlocs2(char* _szBinaryFileName) { BIN_fn_vReadDataFromLinkTableWithoutAllocation(DNM_fn_p_stGetLinkTableOfMecMatCharacteristics(),NULL, sizeof(DNM_tdstMecMatCharacteristics), _szBinaryFileName, DNM_fn_p_cGeneralAllocateFunction); } */