Commit 7d3d27b9 authored by Christophe Geuzaine's avatar Christophe Geuzaine

very simple example in 3 languages

parent 73543f90
Pipeline #1461 passed with stage
in 36 minutes and 21 seconds
#include <gmshc.h>
int main(int argc, char **argv)
{
int ierr;
gmshInitialize(argc, argv, 1, &ierr);
gmshModelAdd("square", &ierr);
gmshModelGeoAddPoint(0, 0, 0, 0.1, 1, &ierr);
gmshModelGeoAddPoint(1, 0, 0, 0.1, 2, &ierr);
gmshModelGeoAddPoint(1, 1, 0, 0.1, 3, &ierr);
gmshModelGeoAddPoint(0, 1, 0, 0.1, 4, &ierr);
gmshModelGeoAddLine(1, 2, 1, &ierr);
gmshModelGeoAddLine(2, 3, 2, &ierr);
gmshModelGeoAddLine(3, 4, 3, &ierr);
// try automatic assignement of tag
int line4 = gmshModelGeoAddLine(4, 1, -1, &ierr);
int ll[] = {1, 2, 3, line4};
gmshModelGeoAddCurveLoop(ll, 4, 1, &ierr);
int s[]= { 1 };
gmshModelGeoAddPlaneSurface(ll, 1, 6, &ierr);
gmshModelGeoSynchronize(&ierr);
gmshModelMeshGenerate(2, &ierr);
gmshWrite("square.msh", &ierr);
return 0;
};
#include <gmsh.h>
int main(int argc, char **argv)
{
gmsh::initialize(argc, argv);
gmsh::model::add("square");
gmsh::model::geo::addPoint(0, 0, 0, 0.1, 1);
gmsh::model::geo::addPoint(1, 0, 0, 0.1, 2);
gmsh::model::geo::addPoint(1, 1, 0, 0.1, 3);
gmsh::model::geo::addPoint(0, 1, 0, 0.1, 4);
gmsh::model::geo::addLine(1, 2, 1);
gmsh::model::geo::addLine(2, 3, 2);
gmsh::model::geo::addLine(3, 4, 3);
// try automatic assignement of tag
int line4 = gmsh::model::geo::addLine(4, 1);
gmsh::model::geo::addCurveLoop({1, 2, 3, line4}, 1);
gmsh::model::geo::addPlaneSurface({1}, 6);
gmsh::model::geo::synchronize();
gmsh::model::mesh::generate(2);
gmsh::write("square.msh");
return 0;
};
import gmsh
import sys
gmsh.initialize(sys.argv)
gmsh.model.add("square")
gmsh.model.geo.addPoint(0, 0, 0, 0.1, 1)
gmsh.model.geo.addPoint(1, 0, 0, 0.1, 2)
gmsh.model.geo.addPoint(1, 1, 0, 0.1, 3)
gmsh.model.geo.addPoint(0, 1, 0, 0.1, 4)
gmsh.model.geo.addLine(1, 2, 1)
gmsh.model.geo.addLine(2, 3, 2)
gmsh.model.geo.addLine(3, 4, 3)
# try automatic assignement of tag
line4 = gmsh.model.geo.addLine(4, 1)
gmsh.model.geo.addCurveLoop([1, 2, 3, line4], 1)
gmsh.model.geo.addPlaneSurface([1], 6)
gmsh.model.geo.synchronize()
gmsh.model.mesh.generate(2)
gmsh.write("square.msh")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment