Skip to content

Commit

Permalink
use public apis
Browse files Browse the repository at this point in the history
  • Loading branch information
cwsmith committed Mar 5, 2024
1 parent b9afe41 commit f37053e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
11 changes: 6 additions & 5 deletions phasta/phAttrib.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@
#include <lionPrint.h>
#include <SimAttribute.h>
#include <SimUtil.h>
#include <SimModel.h>
#include <cstdlib>
#include <iostream>

/* Simmetrix, for the love of all that is good,
please put this in your header files.
We can't work with files from Simmodeler without it. */
pAManager SModel_attManager(pModel model);

typedef ph::BC* (*BCFactory)(pAttribute a, pGEntity ge);
typedef std::map<std::string, BCFactory> BCFactories;
Expand Down Expand Up @@ -224,7 +221,11 @@ static void addAttributes(BCFactories& fs, pPList as, pGEntity ge,
namespace {
void getSimModelAndCase(gmi_model* m, pGModel& smdl, pACase& pd) {
smdl = gmi_export_sim(m);
pAManager mngr = SModel_attManager(smdl);
#if SIMMODSUITE_MAJOR_VERSION < 2024 && SIMMODSUITE_MINOR_VERSION < 240219
pAManager mngr = GM_attManager(smdl);
#else
pAManager mngr = GM_attManager(smdl,true);
#endif
if (!mngr) {
lion_eprint(1,"Simmetrix model did not come with an Attribute Manager\n");
abort();
Expand Down
8 changes: 6 additions & 2 deletions test/generate.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <PCU.h>
#include <lionPrint.h>
#include <MeshSim.h>
#include <SimModel.h>
#include <SimDiscrete.h>
#include <SimAdvMeshing.h>
#include <SimPartitionedMesh.h>
Expand Down Expand Up @@ -39,7 +40,6 @@
#include "SimAttribute.h"
#include "ModelTypes.h"

pAManager SModel_attManager(pModel model);

namespace {

Expand Down Expand Up @@ -74,7 +74,11 @@ void messageHandler(int type, const char* msg)
}

pParMesh generate(pGModel mdl, std::string meshCaseName) {
pAManager attmngr = SModel_attManager(mdl);
#if SIMMODSUITE_MAJOR_VERSION < 2024 && SIMMODSUITE_MINOR_VERSION < 240219
pAManager attmngr = GM_attManager(mdl);
#else
pAManager attmngr = GM_attManager(mdl,true);
#endif
if(0==PCU_Comm_Self())
fprintf(stdout, "Loading mesh case %s...\n", meshCaseName.c_str());
pACase mcaseFile = AMAN_findCase(attmngr, meshCaseName.c_str());
Expand Down
11 changes: 6 additions & 5 deletions test/simTranslate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ void messageHandler(int type, const char *msg);
void progressHandler(const char *what, int level, int startVal,
int endVal, int currentVal, void *);

void SModel_setAttManager(pModel model, pAManager attMan);
pAManager SModel_attManager(pModel model);

/* Constants (ugh -- FIXME) */
static std::string acisExt = ".sat";
static std::string paraExt = ".xmt_txt";
Expand Down Expand Up @@ -164,13 +161,17 @@ int main(int argc, char* argv[])
if (argc == 4) {
try {
pGModel oldmodel = GM_load(argv[2], NULL, NULL);
attmngr = SModel_attManager(oldmodel);
#if SIMMODSUITE_MAJOR_VERSION < 2024 && SIMMODSUITE_MINOR_VERSION < 240219
attmngr = GM_attManager(oldmodel);
#else
attmngr = GM_attManager(oldmodel,true);
#endif
//attmngr = AMAN_load(argv[2]);
if(!attmngr) {
fprintf(stderr, "file \"%s\" contains no attributes", argv[2]);
abort();
}
SModel_setAttManager(simmodel, attmngr);
GM_setAttManager(simmodel, attmngr);
pACase currentCase;
pPList allCases = AMAN_cases(attmngr);
void* iter = 0;
Expand Down

0 comments on commit f37053e

Please sign in to comment.