Custom property problem in bonded model
Hi,
I meet some problems when I introduced a new bonded model based on code in BondedParticle_CM_v3_1_0.
1. I have added some parameters in "BOND_PREFS", so I modified the "bool CBonded::getDetailsForProperty", I added the number of value from 7 to 10; as below, but there is something wrong in the pointer. When the value from m_BondPrefsDelta[n] added to m_BondPrefs[n], the value of m_BondPrefsDelta[6] and m_BondPrefsDelta[7] changed as figure shows, both of it added a value 0f 7 I don't know where is from.
if (5 == propertyIndex && eContact == category) { strncpy(name, BOND_PREFS.c_str(), NApi::CUSTOM_PROP_MAX_NAME_LENGTH); dataType = eDouble; numberOfElements = 10; unitType = eNone; // Initialization of the property values in this case 0.0 for all components - ten in total std::ostringstream oss; oss << 0.0 << NApi::delim() << 0.0 << NApi::delim() << 0.0 << NApi::delim() << 0.0 << NApi::delim() << 0.0 << NApi::delim() << 0.0 << NApi::delim() << 0.0 << NApi::delim() << 0.0 << NApi::delim() << 0.0 << NApi::delim() << 0.0; strncpy(initValBuff, oss.str().c_str(), NApi::BUFF_SIZE); return true; }
2.I am not sure if I have made mistakes or missed somthing in the "propertyIndex", because when debug the code, I found in "getDetailsForProperty", some values of property cannot respond to the iBondPrefs, for example: my total number of custom properties is 9, but the value of "iBOND_TANGENTIAL_TORQUE_B" is 12, how to know the value "iBondPrefs" when I change the code in "getDetailsForProperty"?
Regard!
Raheem
Answers
-
Hi,
1. It's hard to say without seeing your full source code but all I can imagine is somewhere you are setting a value for m_BondPrefsDelta[6] and m_BondPrefsDelta[7]. Debugging the code in VS really ought to be able to tell you where these values are coming from. You could try setting a conditional breakpoint to only stop when the value for this property changes.
2. The values for all the iBond... properties are set in starting( ). For the bonded model the contact custom property manager is being called to get the index of each property. These should just line up with however you are defining the custom properties in getDetailsForProperty( ) though. I don't know how you can define a property as index 9 and retrieve 12 though.
If you have been doing a lot of testing with different custom properties in a deck, I would either start again with a new deck or export a another deck without custom properties exported. If you are renaming properties or setting new numbers of elements then it's quite easy to get EDEM confused.Cheers,
Richard
0