Skip to content

Commit

Permalink
Fixed issue with restart that contains rigid components.
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveMaas1978 committed Oct 22, 2024
1 parent b85abcb commit 803629f
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 12 deletions.
2 changes: 2 additions & 0 deletions FEBioLib/FEBioRestart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ SOFTWARE.*/
#include <FEBioXML/FERestartImport.h>
#include <FECore/DumpFile.h>
#include <FECore/FEAnalysis.h>
#include "FEBioModelBuilder.h"

//-----------------------------------------------------------------------------
FEBioRestart::FEBioRestart(FEModel* pfem) : FECoreTask(pfem) {}
Expand Down Expand Up @@ -75,6 +76,7 @@ bool FEBioRestart::Init(const char* szfile)

// the file is assumed to be a xml-text input file
FERestartImport file;
file.SetModelBuilder(new FEBioModelBuilder(fem));
if (file.Load(fem, szfile) == false)
{
char szerr[256];
Expand Down
8 changes: 0 additions & 8 deletions FEBioXML/FEBioImport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,14 +341,6 @@ bool FEBioImport::Load(FEModel& fem, const char* szfile)
return true;
}

//-----------------------------------------------------------------------------
//! set a custom model builder
void FEBioImport::SetModelBuilder(FEModelBuilder* modelBuilder)
{
delete m_builder;
m_builder = modelBuilder;
}

//-----------------------------------------------------------------------------
// This function parses the XML input file. The broot parameter is used to indicate
// if this is the main control file or an included file.
Expand Down
3 changes: 0 additions & 3 deletions FEBioXML/FEBioImport.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,6 @@ class FEBIOXML_API FEBioImport : public FEFileImport
//! read the contents of a file
bool ReadFile(const char* szfile, bool broot = true);

//! set a custom model builder (takes ownership of modelBuilder)
void SetModelBuilder(FEModelBuilder* modelBuilder);

public:
void SetDumpfileName(const char* sz);
void SetLogfileName (const char* sz);
Expand Down
2 changes: 1 addition & 1 deletion FEBioXML/FERestartImport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ bool FERestartImport::Load(FEModel& fem, const char* szfile)
// open the XML file
if (m_xml.Open(szfile) == false) return errf("FATAL ERROR: Failed opening restart file %s\n", szfile);

m_builder = new FEModelBuilder(fem);
if (m_builder == nullptr) SetModelBuilder(new FEModelBuilder(fem));

m_szdmp[0] = 0;
m_newSteps = 0;
Expand Down
8 changes: 8 additions & 0 deletions FEBioXML/FileImport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1480,6 +1480,14 @@ FEModel* FEFileImport::GetFEModel()
return &m_builder->GetFEModel();
}

//-----------------------------------------------------------------------------
//! set a custom model builder
void FEFileImport::SetModelBuilder(FEModelBuilder* modelBuilder)
{
delete m_builder;
m_builder = modelBuilder;
}

//-----------------------------------------------------------------------------
//! Get the model builder
FEModelBuilder* FEFileImport::GetBuilder()
Expand Down
3 changes: 3 additions & 0 deletions FEBioXML/FileImport.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ class FEBIOXML_API FEFileImport
//! Get the current FE model that is being processed
FEModel* GetFEModel();

//! set a custom model builder (takes ownership of modelBuilder)
void SetModelBuilder(FEModelBuilder* modelBuilder);

//! Get the model builder
FEModelBuilder* GetBuilder();

Expand Down

0 comments on commit 803629f

Please sign in to comment.