Merge branch 'master' into mpi_fixes

This commit is contained in:
Lukas 2019-05-17 14:06:16 +02:00
commit 16a10fae88
8 changed files with 82 additions and 27 deletions

View File

@ -122,7 +122,7 @@ test_ubuntu_mpi:
test_build_ngsolve:
<<: *ubuntu
allow_failure: true
stage: test
stage: deploy
script:
- >-
docker run

View File

@ -3,8 +3,10 @@ set(METIS_DIR ${CMAKE_CURRENT_BINARY_DIR}/dependencies/metis)
ExternalProject_Add(project_metis
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/dependencies
URL "http://ftp.mcs.anl.gov/pub/petsc/externalpackages/metis-5.1.0-p3.tar.gz"
URL_MD5 09d2d771c63a2efb3499882688100088
#URL "http://ftp.mcs.anl.gov/pub/petsc/externalpackages/metis-5.1.0-p3.tar.gz"
#URL_MD5 09d2d771c63a2efb3499882688100088
URL http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/metis-5.1.0.tar.gz
URL_MD5 5465e67079419a69e0116de24fce58fe
DOWNLOAD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external_dependencies
CMAKE_ARGS
-DGKLIB_PATH=${METIS_SRC_DIR}/GKlib

View File

@ -138,6 +138,47 @@ DLL_HEADER void ExportGeom2d(py::module &m)
self.AppendSegment(seg);
}), py::arg("point_indices"), py::arg("leftdomain") = 1, py::arg("rightdomain") = py::int_(0))
.def("AddCurve",
[] (SplineGeometry2d & self, py::object func,
int leftdomain, int rightdomain, py::object bc, double maxh)
{
int n = 1000;
Array<Point<2>> points;
for (int i = 0; i <= n; i++)
{
double t = double(i)/n;
py::tuple xy = func(t);
double x = py::cast<double>(xy[0]);
double y = py::cast<double>(xy[1]);
points.Append (Point<2>(x,y));
}
auto spline = new DiscretePointsSeg<2> (points);
SplineSegExt * spex = new SplineSegExt (*spline);
spex -> leftdom = leftdomain;
spex -> rightdom = rightdomain;
spex->hmax = maxh;
spex->reffak = 1;
spex->copyfrom = -1;
if (py::extract<int>(bc).check())
spex->bc = py::extract<int>(bc)();
else if (py::extract<string>(bc).check())
{
string bcname = py::extract<string>(bc)();
spex->bc = self.GetNSplines()+1;
self.SetBCName(spex->bc, bcname);
}
else
spex->bc = self.GetNSplines()+1;
self.AppendSegment (spex);
}, py::arg("func"), py::arg("leftdomain") = 1, py::arg("rightdomain") = py::int_(0),
py::arg("bc")=NGDummyArgument(), py::arg("maxh")=1e99,
"Curve is given as parametrization on the interval [0,1]")
.def("SetMaterial", &SplineGeometry2d::SetMaterial)
.def("SetDomainMaxH", &SplineGeometry2d::SetDomainMaxh)

View File

@ -11,6 +11,8 @@
/* Date: 20. Nov. 99 */
/**************************************************************************/
#include "../core/ngcore.hpp"
/*
Application program interface to Netgen

View File

@ -8,6 +8,8 @@
/* Date: May 09 */
/**************************************************************************/
#include "../core/ngcore.hpp"
/*
C++ interface to Netgen
*/

View File

@ -94,7 +94,7 @@ namespace netgen
char ch;
string name;
sbuf >> ch >> name;
cout << "Title: " << name << endl;
PrintMessage(3, "Title: ", name);
}
else if (token == "%STATISTICS")
{
@ -106,7 +106,7 @@ namespace netgen
}
else
{
cout << "SECTION HEADER, unknown field: " << buf << endl;
PrintMessage(1, "SECTION HEADER, unknown field: ",buf);
}
}
}
@ -142,7 +142,7 @@ namespace netgen
}
else
{
cout << "SECTION ELEM_TYPE, unknown field: " << buf << endl;
PrintMessage(1, "SECTION ELEM_TYPE, unknown field: ", buf);
}
}
}
@ -219,7 +219,7 @@ namespace netgen
}
else
{
cout << "SECTION MATERIALS, unknown field: " << buf << endl;
PrintMessage(1, "SECTION MATERIALS, unknown field: ", buf);
}
}
}
@ -271,7 +271,7 @@ namespace netgen
}
else
{
cout << "SECTION MESH, unknown: " << buf << endl;
PrintMessage(1, "SECTION MESH, unknown: ", buf);
}
}
}
@ -349,7 +349,7 @@ namespace netgen
}
else
{
cout << "SECTION MESH, unknown: " << buf << endl;
PrintMessage(1, "SECTION MESH, unknown: ", buf);
}
}
}
@ -378,10 +378,10 @@ namespace netgen
sbuf >> lt->id >> def >> ch >> lt->name >> lt->placement >> lt->valuetype;
if (lt->name == "DISPLACEMENT")
cout << "loadtype DISPLACEMENT found" << endl;
PrintMessage(3, "loadtype DISPLACEMENT found");
if (lt->placement != "FACE" && lt->placement != "EDGE" && lt->placement != "NODE")
cout << "unsupported placement " << lt->placement << endl;
PrintMessage(1, "unsupported placement ", lt->placement);
loadtypes.Append (lt);
}
@ -412,27 +412,29 @@ namespace netgen
{
for (int i = 0; i < loadtypes.Size(); i++)
{
stringstream str;
str << loadtypes[i]->places;
if (loadtypes[i]->placement == "FACE" && loadtypes[i]->name == "DISPLACEMENT")
{
mesh.SetUserData ("CONSTRAINT_DISP_FACE", loadtypes[i]->places);
cout << "constrained faces: " << loadtypes[i]->places << endl;
PrintMessage(3, "constrained faces: ", str.str());
}
if (loadtypes[i]->placement == "EDGE" && loadtypes[i]->name == "DISPLACEMENT")
{
mesh.SetUserData ("CONSTRAINT_DISP_EDGE", loadtypes[i]->places);
cout << "constrained edges: " << loadtypes[i]->places << endl;
PrintMessage(3,"constrained edges: ", str.str());
}
if (loadtypes[i]->placement == "NODE" && loadtypes[i]->name == "DISPLACEMENT")
{
mesh.SetUserData ("CONSTRAINT_DISP_NODE", loadtypes[i]->places);
cout << "constrained nodes: " << loadtypes[i]->places << endl;
PrintMessage(3, "constrained nodes: ", str.str());
}
}
break;
}
else
{
cout << "SECTION LOADS, unknown field: " << buf << endl;
PrintMessage(1, "SECTION LOADS, unknown field: ", buf);
}
}
}
@ -441,11 +443,11 @@ namespace netgen
else
{
cout << "unknown section " << token << endl;
PrintMessage(1, "unknown section ", token);
}
}
else
cout << "parse line: (" << buf << ")" << endl;
PrintMessage(3, "parse line: (", buf, ")");
}
}
}

View File

@ -99,6 +99,7 @@ namespace netgen
// map from unv element nr to our element number + an index if it is vol (0), bnd(1), ...
std::map<size_t, std::tuple<size_t, int>> element_map;
Array<Segment> tmp_segments;
while (in.good())
{
in >> reco;
@ -155,7 +156,9 @@ namespace netgen
el[0] = nodes[0];
el[1] = nodes[2];
el[2] = nodes[1];
auto nr = mesh.AddSegment (el);
auto nr = tmp_segments.Size();
tmp_segments.Append(el);
element_map[label] = std::make_tuple(nr+1, 2);
break;
}
@ -229,7 +232,6 @@ namespace netgen
in >> hi >> index >> hi >> hi;
int codim = get<1>(element_map[index]);
// use first element to determine if boundary or volume
switch (codim)
@ -256,8 +258,9 @@ namespace netgen
ed.SetSurfNr(0,bcpr);//?
ednr = mesh.AddEdgeDescriptor(ed);
mesh.SetCD2Name(bcpr, name);
string * bcname = new string(name);
mesh.LineSegment(get<0>(element_map[index])).SetBCName(bcname);
auto nr = mesh.AddSegment(tmp_segments[get<0>(element_map[index])-1]);
mesh[nr].SetBCName(mesh.GetCD2NamePtr(mesh.GetNCD2Names()));
mesh[nr].edgenr = ednr+1;
break;
}
default:
@ -278,7 +281,11 @@ namespace netgen
mesh.SurfaceElement(get<0>(element_map[index])).SetIndex(fdnr);
break;
case 2:
mesh.LineSegment(get<0>(element_map[index])).edgenr = ednr+1;
{
auto nr = mesh.AddSegment(tmp_segments[get<0>(element_map[index])-1]);
mesh[nr].edgenr = ednr+1;
mesh[nr].SetBCName(mesh.GetCD2NamePtr(mesh.GetNCD2Names()));
}
break;
default:
break;

View File

@ -1101,7 +1101,7 @@ namespace netgen
glEndList ();
if (clipplane_isolinelist) glDeleteLists (clipplane_isolinelist, 1);
if (vispar.clipping.enable && clipsolution == 1 && sol)
{
clipplane_isolinelist = glGenLists (1);
@ -1113,7 +1113,8 @@ namespace netgen
bool drawelem;
glNormal3d (-clipplane[0], -clipplane[1], -clipplane[2]);
glBegin (GL_LINES);
if (numisolines)
for (int i = 0; i < cpt.Size(); i++)
{
@ -1129,13 +1130,11 @@ namespace netgen
DrawIsoLines (pts[trig.points[0].pnr].p,
pts[trig.points[1].pnr].p,
pts[trig.points[2].pnr].p,
// trig.points[1].p,
// trig.points[2].p,
vali[0], vali[1], vali[2]);
}
glEnd();
glEndList ();
}
glEnd();
}
clipplanetimestamp = max2 (vispar.clipping.timestamp, solutiontimestamp);