Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ test_exe_func(ma_insphere ma_insphere.cc)
test_exe_func(ma_test ma_test.cc)
test_exe_func(aniso_ma_test aniso_ma_test.cc)
test_exe_func(torus_ma_test torus_ma_test.cc)
test_exe_func(dg_ma_test dg_ma_test.cc)
test_exe_func(prismCodeMatch ../ma/prismCodeMatch.cc)
test_exe_func(pyramidCodeMatch ../ma/pyramidCodeMatch.cc)
test_exe_func(newdim newdim.cc)
Expand Down
76 changes: 76 additions & 0 deletions test/dg_ma_test.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#include "ma.h"
#include <apf.h>
#include <gmi_mesh.h>
#include <apfMDS.h>
#include <apfShape.h>
#include <PCU.h>
#ifdef HAVE_SIMMETRIX
#include <gmi_sim.h>
#include <SimUtil.h>
#endif
#include <cassert>

class Linear : public ma::IsotropicFunction
{
public:
Linear(ma::Mesh* m)
{
mesh = m;
average = ma::getAverageEdgeLength(m);
ma::getBoundingBox(m,lower,upper);
}
virtual double getValue(ma::Entity* v)
{
ma::Vector p = ma::getPosition(mesh,v);
double x = (p[0] - lower[0])/(upper[0] - lower[0]);
return average*(4*x+2)/3;
}
private:
ma::Mesh* mesh;
double average;
ma::Vector lower;
ma::Vector upper;
};

int main(int argc, char** argv)
{
assert(argc==3);
const char* modelFile = argv[1];
const char* meshFile = argv[2];
MPI_Init(&argc,&argv);
PCU_Comm_Init();
#ifdef HAVE_SIMMETRIX
SimUtil_start();
Sim_readLicenseFile(0);
gmi_sim_start();
gmi_register_sim();
#endif
gmi_register_mesh();
ma::Mesh* m = apf::loadMdsMesh(modelFile,meshFile);
m->verify();
Linear sf(m);
ma::Input* in = ma::configure(m, &sf);
if (!PCU_Comm_Self())
printf("Matched mesh: disabling"
" snapping, and shape correction,\n");
in->shouldSnap = false;
in->shouldFixShape = false;
in->shouldTransferParametric = false;
in->shouldRunPreZoltan = true;
in->shouldRunMidParma = true;
in->shouldRunPostParma = true;
in->shouldRefineLayer = true;
ma::adapt(in);
m->verify();
apf::writeVtkFiles("after",m);
m->destroyNative();
apf::destroyMesh(m);
#ifdef HAVE_SIMMETRIX
gmi_sim_stop();
Sim_unregisterAllKeys();
SimUtil_stop();
#endif
PCU_Comm_Free();
MPI_Finalize();
}

13 changes: 13 additions & 0 deletions test/testing.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@ else()
set(GXT dmg)
endif()

set(MDIR ${MESHES}/phasta/dg)
if(ENABLE_SIMMETRIX)
mpi_test(migrate_interface 4
./migrate_interface
"${MDIR}/box.smd"
"${MDIR}/box.smb"
"${MDIR}/4/")
mpi_test(dg_ma_test 4
./dg_ma_test
"${MDIR}/box.smd"
"${MDIR}/4/")
endif(ENABLE_SIMMETRIX)

mpi_test(pumi3d-1p 4
./test_pumi
${MESHES}/pumi/3d-1p/model.dmg
Expand Down