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

move api_demos to demos/

parent 71fde173
No related branches found
No related tags found
No related merge requests found
...@@ -469,9 +469,9 @@ int gmshModelAddEmbedded(int dim, const std::vector<int> &tags, int toDim, int t ...@@ -469,9 +469,9 @@ int gmshModelAddEmbedded(int dim, const std::vector<int> &tags, int toDim, int t
// gmshModelGeo // gmshModelGeo
int gmshModelGeoAddVertex(int &tag, double x, double y, double z, double lc) int gmshModelGeoAddVertex(int &tag, double x, double y, double z, double meshSize)
{ {
return !GModel::current()->getGEOInternals()->addVertex(tag, x, y, z, lc); return !GModel::current()->getGEOInternals()->addVertex(tag, x, y, z, meshSize);
} }
int gmshModelGeoAddLine(int &tag, int startTag, int endTag) int gmshModelGeoAddLine(int &tag, int startTag, int endTag)
...@@ -642,4 +642,13 @@ int gmshModelGeoSynchronize() ...@@ -642,4 +642,13 @@ int gmshModelGeoSynchronize()
// gmshModelOCC // gmshModelOCC
static void createOcc()
{
if(!GModel::current()->getOCCInternals()) GModel::current()->createOCCInternals();
}
int gmshModelOccAddVertex(int &tag, double x, double y, double z, double meshSize)
{
createOcc();
return !GModel::current()->getOCCInternals()->addVertex(tag, x, y, z, meshSize);
}
...@@ -82,7 +82,7 @@ GMSH_API gmshModelAddEmbedded(int dim, const std::vector<int> &tags, ...@@ -82,7 +82,7 @@ GMSH_API gmshModelAddEmbedded(int dim, const std::vector<int> &tags,
int toDim, int toTag); int toDim, int toTag);
// gmshModelGeo // gmshModelGeo
GMSH_API gmshModelGeoAddVertex(int &tag, double x, double y, double z, double lc); GMSH_API gmshModelGeoAddVertex(int &tag, double x, double y, double z, double meshSize);
GMSH_API gmshModelGeoAddLine(int &tag, int startTag, int endTag); GMSH_API gmshModelGeoAddLine(int &tag, int startTag, int endTag);
GMSH_API gmshModelGeoAddCircleArc(int &tag, int startTag, int centerTag, int endTag, GMSH_API gmshModelGeoAddCircleArc(int &tag, int startTag, int centerTag, int endTag,
double nx=0., double ny=0., double nz=0.); double nx=0., double ny=0., double nz=0.);
...@@ -135,7 +135,8 @@ GMSH_API gmshModelGeoRemove(const std::vector<std::pair<int, int> > &dimTags, ...@@ -135,7 +135,8 @@ GMSH_API gmshModelGeoRemove(const std::vector<std::pair<int, int> > &dimTags,
GMSH_API gmshModelGeoRemoveAllDuplicates(); GMSH_API gmshModelGeoRemoveAllDuplicates();
GMSH_API gmshModelGeoSynchronize(); GMSH_API gmshModelGeoSynchronize();
// gmshModelOCC // gmshModelOcc
GMSH_API gmshModelOccAddVertex(int &tag, double x, double y, double z, double meshSize);
// gmshSolver // gmshSolver
......
...@@ -1328,16 +1328,13 @@ static void updateHighOrderVertices(GEntity *e, ...@@ -1328,16 +1328,13 @@ static void updateHighOrderVertices(GEntity *e,
static void updatePeriodicEdgesAndFaces(GModel *m) static void updatePeriodicEdgesAndFaces(GModel *m)
{ {
// Edges // Edges
for(GModel::eiter it = m->firstEdge(); it != m->lastEdge(); ++it) { for(GModel::eiter it = m->firstEdge(); it != m->lastEdge(); ++it) {
GEdge *tgt = *it; GEdge *tgt = *it;
GEdge *src = dynamic_cast<GEdge*>(tgt->meshMaster()); GEdge *src = dynamic_cast<GEdge*>(tgt->meshMaster());
if (src != NULL && src != tgt) { if (src != NULL && src != tgt) {
std::map<MVertex*,MVertex*> &v2v = tgt->correspondingVertices; std::map<MVertex*,MVertex*> &v2v = tgt->correspondingVertices;
std::map<MVertex*,MVertex*> &p2p = tgt->correspondingHOPoints; std::map<MVertex*,MVertex*> &p2p = tgt->correspondingHOPoints;
p2p.clear(); p2p.clear();
...@@ -1355,10 +1352,8 @@ static void updatePeriodicEdgesAndFaces(GModel *m) ...@@ -1355,10 +1352,8 @@ static void updatePeriodicEdgesAndFaces(GModel *m)
} }
for (unsigned int i = 0; i < tgt->getNumMeshElements(); ++i) { for (unsigned int i = 0; i < tgt->getNumMeshElements(); ++i) {
MLine* tgtLine = dynamic_cast<MLine*> (tgt->getMeshElement(i)); MLine* tgtLine = dynamic_cast<MLine*> (tgt->getMeshElement(i));
MVertex* vtcs[2]; MVertex* vtcs[2];
if (!tgtLine) Msg::Error("Slave element %d is not an edge ", if (!tgtLine) Msg::Error("Slave element %d is not an edge ",
tgt->getMeshElement(i)->getNum()); tgt->getMeshElement(i)->getNum());
...@@ -1373,7 +1368,8 @@ static void updatePeriodicEdgesAndFaces(GModel *m) ...@@ -1373,7 +1368,8 @@ static void updatePeriodicEdgesAndFaces(GModel *m)
else vtcs[iVtx] = tIter->second; else vtcs[iVtx] = tIter->second;
} }
std::map<MEdge,MLine*,Less_Edge>::iterator srcIter = srcEdges.find(MEdge(vtcs[0],vtcs[1])); std::map<MEdge,MLine*,Less_Edge>::iterator srcIter =
srcEdges.find(MEdge(vtcs[0],vtcs[1]));
if (srcIter == srcEdges.end()) { if (srcIter == srcEdges.end()) {
Msg::Error("Can't find periodic counterpart of edge %d-%d on edge %d" Msg::Error("Can't find periodic counterpart of edge %d-%d on edge %d"
", connected to edge %d-%d on %d", ", connected to edge %d-%d on %d",
...@@ -1387,7 +1383,8 @@ static void updatePeriodicEdgesAndFaces(GModel *m) ...@@ -1387,7 +1383,8 @@ static void updatePeriodicEdgesAndFaces(GModel *m)
else { else {
MLine* srcLine = srcIter->second; MLine* srcLine = srcIter->second;
if (tgtLine->getNumVertices() != srcLine->getNumVertices()) throw; if (tgtLine->getNumVertices() != srcLine->getNumVertices()) throw;
for (int i=2;i<tgtLine->getNumVertices();i++) p2p[tgtLine->getVertex(i)] = srcLine->getVertex(i); for (int i = 2; i < tgtLine->getNumVertices(); i++)
p2p[tgtLine->getVertex(i)] = srcLine->getVertex(i);
} }
} }
} }
...@@ -1397,7 +1394,6 @@ static void updatePeriodicEdgesAndFaces(GModel *m) ...@@ -1397,7 +1394,6 @@ static void updatePeriodicEdgesAndFaces(GModel *m)
GFace *tgt = *it; GFace *tgt = *it;
GFace *src = dynamic_cast<GFace*>(tgt->meshMaster()); GFace *src = dynamic_cast<GFace*>(tgt->meshMaster());
if (src != NULL && src != tgt) { if (src != NULL && src != tgt) {
Msg::Info("Constructing high order periodicity for face connection %d - %d", Msg::Info("Constructing high order periodicity for face connection %d - %d",
tgt->tag(),src->tag()); tgt->tag(),src->tag());
...@@ -1420,7 +1416,6 @@ static void updatePeriodicEdgesAndFaces(GModel *m) ...@@ -1420,7 +1416,6 @@ static void updatePeriodicEdgesAndFaces(GModel *m)
} }
for (unsigned int i = 0; i < tgt->getNumMeshElements(); ++i) { for (unsigned int i = 0; i < tgt->getNumMeshElements(); ++i) {
MElement* tgtElmt = tgt->getMeshElement(i); MElement* tgtElmt = tgt->getMeshElement(i);
Msg::Info("Checking element %d in face %d",i,tgt->tag()); Msg::Info("Checking element %d in face %d",i,tgt->tag());
...@@ -1447,7 +1442,8 @@ static void updatePeriodicEdgesAndFaces(GModel *m) ...@@ -1447,7 +1442,8 @@ static void updatePeriodicEdgesAndFaces(GModel *m)
std::map<MFace,MElement*>::iterator srcIter = srcFaces.find(MFace(vtcs)); std::map<MFace,MElement*>::iterator srcIter = srcFaces.find(MFace(vtcs));
if (srcIter == srcFaces.end()) { if (srcIter == srcFaces.end()) {
std::ostringstream faceDef; std::ostringstream faceDef;
for (int iVtx=0;iVtx<nbVtcs;iVtx++) faceDef << vtcs[iVtx]->getNum() << " "; for (int iVtx = 0; iVtx < nbVtcs; iVtx++)
faceDef << vtcs[iVtx]->getNum() << " ";
Msg::Error("Cannot find periodic counterpart of face %s in face %d " Msg::Error("Cannot find periodic counterpart of face %s in face %d "
"connected to %d",faceDef.str().c_str(), "connected to %d",faceDef.str().c_str(),
tgt->tag(),src->tag()); tgt->tag(),src->tag());
...@@ -1461,7 +1457,7 @@ static void updatePeriodicEdgesAndFaces(GModel *m) ...@@ -1461,7 +1457,7 @@ static void updatePeriodicEdgesAndFaces(GModel *m)
} }
} }
} }
Msg::Info("Finalized high order topology of periodic connections"); Msg::Debug("Finalized high order topology of periodic connections");
} }
void SetOrder1(GModel *m, bool onlyVisible) void SetOrder1(GModel *m, bool onlyVisible)
......
File moved
File moved
File moved
...@@ -7,6 +7,7 @@ int main(int argc, char **argv) ...@@ -7,6 +7,7 @@ int main(int argc, char **argv)
{ {
gmshInitialize(argc, argv); gmshInitialize(argc, argv);
gmshOptionSetNumber("General.Terminal", 1); gmshOptionSetNumber("General.Terminal", 1);
gmshModelCreate("t1"); gmshModelCreate("t1");
double lc = 1e-2; double lc = 1e-2;
...@@ -39,9 +40,11 @@ int main(int argc, char **argv) ...@@ -39,9 +40,11 @@ int main(int argc, char **argv)
gmshModelSetPhysicalName(2, 6, "My surface"); gmshModelSetPhysicalName(2, 6, "My surface");
gmshModelGeoSynchronize(); gmshModelGeoSynchronize();
gmshModelMesh(2); gmshModelMesh(2);
gmshExport("t1.msh"); gmshExport("t1.msh");
gmshFinalize(); gmshFinalize();
return 0; return 0;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment