Skip to content

Only use states for non-coupled objects #294

@RyanDavies19

Description

@RyanDavies19

Related to the discussion in #291

We should try to avoid states are being allocated and assigned to coupled objects, because their dynamics are solved externally. MD-F does not add coupled object states to the state list. I know the performance improvements will probably be minimal, but it would probably help. I will involve changing the loops over <object>List that involve state calculations. For example in the main Init function, change t_integrator.Add<object> to iterate over the free objects. I.e. change:

	t_integrator.SetGround(GroundBody);
	for (auto obj : BodyList)
		t_integrator.AddBody(obj);
	for (auto obj : RodList)
		t_integrator.AddRod(obj);
	for (auto obj : PointList)
		t_integrator.AddPoint(obj);
	for (auto obj : LineList)
		t_integrator.AddLine(obj);

to the following (in icLegacy and icStationary in MoorDyn2.cpp):

	t_integrator.SetGround(GroundBody);
	for (unsigned int i : FreeBodyIs)
		t_integrator.AddBody(BodyList[i]);
	for (unsigned int i : FreeRodIs)
		t_integrator.AddRod(RodList[i]);
	for (unsigned int i : FreePointIs)
		t_integrator.AddPoint(PointList[i]);
	for (auto obj : LineList)
		t_integrator.AddLine(obj);

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions