Before all the initialization of all components is done, components may not really access the domain at all (which is what you do in initParams(), which you call from initializeFrom). You might not get away with it when you have sequential numbering, but the real solution would be to avoid this type of operations this early.
Initialization is done in stages;
1. initializeFrom <-- Reads all the input records. You may also set up basic things if necessary.
2. postInitialize <--- Runs after initializeFrom is completed for all components
3. checkConsistency <--- Runs after all initialization is done, verifies that everything is properly set up (shouldn't modify the components, just check that stuff works).
If you move this section
if (this->coords.giveNumberOfColumns() == 0 || this->coords.giveNumberOfRows() == 0)
{
this->coords.resize(this->numberOfDofMans, this->mcrd);
for (int j = 0; j < numberOfDofMans; j++)
{
Node *dm = this->giveNode(j + 1);
for (int i = 0; i < mcrd; i++)
{
this->coords(i, j) = dm->giveCoordinate(i + 1);
}
}
}
to the function "AbaqusUserElement::postInitialize()", then it should work. So:
void
AbaqusUserElement :: postInitialize()
{
NLStructuralElement :: postInitialize();
if (this->coords.giveNumberOfColumns() == 0 || this->coords.giveNumberOfRows() == 0)
{
this->coords.resize(this->numberOfDofMans, this->mcrd);
for (int j = 0; j < numberOfDofMans; j++)
{
Node *dm = this->giveNode(j + 1);
for (int i = 0; i < mcrd; i++)
{
this->coords(i, j) = dm->giveCoordinate(i + 1);
}
}
}
}
Before accepting your code into OOFEM, there are a few things I've like to see you clean up;
1.
result = IR_GIVE_FIELD(ir, this->nCoords, _IFT_AbaqusUserElement_numcoords);
if (result != IRResultType::IRRT_OK) OOFEM_ERROR("'coords' field not defined or not correctly formatted");
This is not necessary. The IR_GIVE_FIELD already takes care of error reporting
2. If I remember correctly, you should be able to simplify "AbaqusUserElement::giveDofManDofIDMask" to just the user-supplied dof array: "answer = this->dofs"
3. Add the missing stuff in "giveInputRecord"
4. Indentation and coding style ( http://uncrustify.sourceforge.net/ )
5. Documentation in doxygen style (see other classes in OOFEM)
Post's attachmentsgiovanni.zip 682.49 kb, 4 downloads since 2014-10-29
You don't have the permssions to download the attachments of this post.