Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gmsh.cc: add test that passes an input .dmg model #415

Open
cwsmith opened this issue Jan 18, 2024 · 2 comments
Open

gmsh.cc: add test that passes an input .dmg model #415

cwsmith opened this issue Jan 18, 2024 · 2 comments

Comments

@cwsmith
Copy link
Contributor

cwsmith commented Jan 18, 2024

We need to that a case where the first argument, the input model, is not none:

core/test/testing.cmake

Lines 231 to 244 in d7cc6c8

mpi_test(gmshv2TwoQuads 1
./from_gmsh
"none"
"${MDIR}/twoQuads.msh"
"${MDIR}/twoQuads.smb"
"${MDIR}/twoQuads.dmg")
set(MDIR ${MESHES}/gmsh/v4)
mpi_test(gmshV4AirFoil 1
./from_gmsh
"none"
"${MDIR}/AirfoilDemo.msh"
"${MDIR}/AirfoilDemo.smb"
"${MDIR}/AirfoilDemo.dmg")

This caused problems with a downstream tool: SCOREC/gmshToPumi#2

Note, the test/gmsh.cc (from_gmsh) command line interface has changed a couple times since this repo/example was created. The first change added support for deriving a model if a .null model was passed in (30d5d9f) and the second major change added support for gmsh v4 (b27c9b2).

@zhangchonglin
Copy link
Contributor

@cwsmith: thanks for creating this issue. From looking at the gmsh.cc code:

core/test/gmsh.cc

Lines 40 to 52 in d7cc6c8

if (gmshVersion == 2) {
if (model.compare("none") == 0) {
m = apf::loadMdsFromGmsh(gmi_load(".null"), gmsh.c_str());
apf::deriveMdsModel(m);
gmi_write_dmg(m->getModel(),outModel.c_str());
} else {
m = apf::loadMdsFromGmsh(gmi_load(model.c_str()), gmsh.c_str());
}
} else if (gmshVersion == 4) {
if (model.compare("none") == 0) {
m = apf::loadMdsDmgFromGmsh(outModel.c_str(), gmsh.c_str());
}
}

  • it seems that with gmsh version 4, the .dmg file is not needed, where function loadMdsDmgFromGmsh does not accept .dmg input file:

    core/mds/mdsGmsh.cc

    Lines 469 to 475 in d7cc6c8

    Mesh2* loadMdsDmgFromGmsh(const char*fnameDmg, const char* filename)
    {
    gmshFindDmg(fnameDmg, filename); // new function that scans $Entities and writes a dmg
    Mesh2* m = makeEmptyMdsMesh(gmi_load(fnameDmg), 0, false);
    readGmsh(m, filename);
    return m;
    }

  • for gmsh version 2, .dmg input file is an optional file.

It seems that the if statement corresponding to gmshVersion == 4 needs to be restructured to be consistent with all types of input arguments.

@cwsmith
Copy link
Contributor Author

cwsmith commented Jan 18, 2024

it seems that with gmsh version 4, the .dmg file is not needed

That is correct, v4 can embed sufficient info into the .msh file for creating the output .dmg. I'm not sure if all v4 gmsh meshes will have this info though.

loadMdsDmgFromGmsh does not accept .dmg input file

Yeah, thanks for digging.

Regarding the if statement in gmsh.cc for v4, I agree, there should at least be an else that prints a helpful error message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants