Skip to content
Snippets Groups Projects
Commit 90bae6d5 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

add simple example for creating a geometry using the factory

parent 25acf39d
No related branches found
No related tags found
No related merge requests found
...@@ -53,3 +53,6 @@ target_link_libraries(mainPost shared) ...@@ -53,3 +53,6 @@ target_link_libraries(mainPost shared)
add_executable(mainSimple mainSimple.cpp) add_executable(mainSimple mainSimple.cpp)
target_link_libraries(mainSimple shared) target_link_libraries(mainSimple shared)
add_executable(mainGeoFactory mainGeoFactory.cpp)
target_link_libraries(mainGeoFactory shared)
...@@ -28,7 +28,7 @@ void InitializeOnelab(std::string sockName, std::string modelName) { ...@@ -28,7 +28,7 @@ void InitializeOnelab(std::string sockName, std::string modelName) {
ps[0].setValue(modelName); ps[0].setValue(modelName);
loader->set(ps[0]); loader->set(ps[0]);
} }
/*
void AddOnelabNumberChoice(std::string name, double val, std::string help) void AddOnelabNumberChoice(std::string name, double val, std::string help)
{ {
std::vector<double> choices; std::vector<double> choices;
......
#include <stdio.h>
#include "Gmsh.h"
#include "GModel.h"
int main(int argc, char **argv)
{
GmshInitialize(argc, argv);
GModel *m = new GModel();
GVertex *v1 = m->addVertex(0, 0, 0, 0.1);
GVertex *v2 = m->addVertex(1, 0, 0, 0.1);
GVertex *v3 = m->addVertex(1, 1, 0, 0.1);
GVertex *v4 = m->addVertex(0, 1, 0, 0.1);
std::vector<GEdge*> edges;
edges.push_back(m->addLine(v1, v2));
edges.push_back(m->addLine(v2, v3));
edges.push_back(m->addLine(v3, v4));
edges.push_back(m->addLine(v4, v1));
std::vector<std::vector<GEdge*> > loop;
loop.push_back(edges);
GFace *f = m->addPlanarFace(loop);
m->mesh(2);
m->writeMSH("test.msh");
delete m;
GmshFinalize();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment