mirror of
https://github.com/NGSolve/netgen.git
synced 2025-02-03 16:50:34 +05:00
Merge branch 'gitlab_mpi_builds' into metis_pic
This commit is contained in:
commit
59c4ec78d3
@ -87,6 +87,16 @@ build_ubuntu:
|
||||
- docker commit `cat netgen_${CI_BUILD_REF_NAME}_${UBUNTU_VERSION}.id` netgen_${CI_BUILD_REF_NAME}_installed:${UBUNTU_VERSION}
|
||||
- rm netgen_${CI_BUILD_REF_NAME}_${UBUNTU_VERSION}.id
|
||||
|
||||
build_ubuntu_mpi:
|
||||
<<: *ubuntu
|
||||
stage: build
|
||||
script:
|
||||
- docker build -t netgen_mpi_${CI_BUILD_REF_NAME}:${UBUNTU_VERSION} -f tests/dockerfile_mpi .
|
||||
- rm -f netgen_mpi_${CI_BUILD_REF_NAME}_$UBUNTU_VERSION.id_mpi
|
||||
- docker run --cidfile netgen_mpi_${CI_BUILD_REF_NAME}_${UBUNTU_VERSION}.id -e CCACHE_DIR=/ccache -v /mnt/ccache:/ccache netgen_mpi_${CI_BUILD_REF_NAME}:${UBUNTU_VERSION} bash /root/src/netgen/tests/build_mpi.sh
|
||||
- docker commit `cat netgen_mpi_${CI_BUILD_REF_NAME}_${UBUNTU_VERSION}.id` netgen_mpi_${CI_BUILD_REF_NAME}_installed:${UBUNTU_VERSION}
|
||||
- rm netgen_mpi_${CI_BUILD_REF_NAME}_${UBUNTU_VERSION}.id
|
||||
|
||||
test_ubuntu:
|
||||
<<: *ubuntu
|
||||
stage: test
|
||||
@ -98,6 +108,17 @@ test_ubuntu:
|
||||
netgen_${CI_BUILD_REF_NAME}_installed:${UBUNTU_VERSION}
|
||||
bash -c 'cd /root/build/netgen && make test_netgen ARGS="-V"'
|
||||
|
||||
test_ubuntu_mpi:
|
||||
<<: *ubuntu
|
||||
stage: test
|
||||
script:
|
||||
- >-
|
||||
docker run
|
||||
-e NETGENDIR=/opt/netgen/bin
|
||||
-e PYTHONPATH=/opt/netgen/lib/python3/dist-packages
|
||||
netgen_mpi_${CI_BUILD_REF_NAME}_installed:${UBUNTU_VERSION}
|
||||
bash -c 'cd /root/build/netgen && make test_netgen ARGS="-V"'
|
||||
|
||||
# cpp guideline checks
|
||||
test_guidelines:
|
||||
<<: *ubuntu
|
||||
@ -125,6 +146,7 @@ cleanup_ubuntu:
|
||||
when: always
|
||||
allow_failure: true
|
||||
|
||||
|
||||
############################################
|
||||
# MacOSX
|
||||
############################################
|
||||
|
@ -12,7 +12,9 @@ if(APPLE)
|
||||
endif(APPLE)
|
||||
|
||||
target_link_libraries(csg PUBLIC mesh ${PYTHON_LIBRARIES})
|
||||
install( TARGETS csg ${NG_INSTALL_DIR})
|
||||
if(NOT WIN32)
|
||||
install( TARGETS csg ${NG_INSTALL_DIR})
|
||||
endif(NOT WIN32)
|
||||
|
||||
target_link_libraries(csg PUBLIC ngcore)
|
||||
|
||||
|
@ -5,7 +5,9 @@ if(APPLE)
|
||||
endif(APPLE)
|
||||
|
||||
target_link_libraries(geom2d mesh ${PYTHON_LIBRARIES})
|
||||
install( TARGETS geom2d ${NG_INSTALL_DIR})
|
||||
if(NOT WIN32)
|
||||
install( TARGETS geom2d ${NG_INSTALL_DIR})
|
||||
endif(NOT WIN32)
|
||||
|
||||
target_link_libraries(geom2d ngcore)
|
||||
|
||||
|
@ -9,7 +9,9 @@ add_library(interface ${NG_LIB_TYPE}
|
||||
|
||||
target_link_libraries(interface mesh csg geom2d)
|
||||
target_link_libraries(interface visual)
|
||||
install( TARGETS interface ${NG_INSTALL_DIR})
|
||||
if(NOT WIN32)
|
||||
install( TARGETS interface ${NG_INSTALL_DIR})
|
||||
endif(NOT WIN32)
|
||||
|
||||
install(FILES
|
||||
writeuser.hpp
|
||||
|
@ -260,6 +260,7 @@ namespace netgen
|
||||
|
||||
Point3d pmin, pmax;
|
||||
mesh.ComputeNVertices();
|
||||
mesh.RebuildSurfaceElementLists();
|
||||
mesh.GetBox (pmin, pmax);
|
||||
cout << "bounding-box = " << pmin << "-" << pmax << endl;
|
||||
}
|
||||
|
@ -24,7 +24,9 @@ endif(APPLE)
|
||||
target_link_libraries( mesh PUBLIC ngcore PRIVATE gprim la gen )
|
||||
|
||||
target_link_libraries( mesh PUBLIC ${ZLIB_LIBRARIES} ${MPI_CXX_LIBRARIES} ${PYTHON_LIBRARIES} ${METIS_LIBRARY})
|
||||
install( TARGETS mesh ${NG_INSTALL_DIR})
|
||||
if(NOT WIN32)
|
||||
install( TARGETS mesh ${NG_INSTALL_DIR})
|
||||
endif(NOT WIN32)
|
||||
|
||||
install(FILES
|
||||
adfront2.hpp adfront3.hpp basegeom.hpp bcfunctions.hpp bisect.hpp
|
||||
|
@ -409,6 +409,15 @@ namespace netgen
|
||||
|
||||
static Array<shared_ptr<RecPol>> jacpols2;
|
||||
|
||||
void CurvedElements::buildJacPols()
|
||||
{
|
||||
if (!jacpols2.Size())
|
||||
{
|
||||
jacpols2.SetSize (100);
|
||||
for (int i = 0; i < 100; i++)
|
||||
jacpols2[i] = make_shared<JacobiRecPol> (100, i, 2);
|
||||
}
|
||||
}
|
||||
|
||||
// compute face bubbles up to order n, 0 < y, y-x < 1, x+y < 1
|
||||
template <class Tx, class Ty, class Ts>
|
||||
@ -540,7 +549,6 @@ namespace netgen
|
||||
|
||||
CurvedElements :: ~CurvedElements()
|
||||
{
|
||||
jacpols2.SetSize(0);
|
||||
}
|
||||
|
||||
|
||||
@ -719,13 +727,7 @@ namespace netgen
|
||||
|
||||
ComputeGaussRule (aorder+4, xi, weight); // on (0,1)
|
||||
|
||||
if (!jacpols2.Size())
|
||||
{
|
||||
jacpols2.SetSize (100);
|
||||
for (int i = 0; i < 100; i++)
|
||||
jacpols2[i] = make_shared<JacobiRecPol> (100, i, 2);
|
||||
}
|
||||
|
||||
buildJacPols();
|
||||
PrintMessage (3, "Curving edges");
|
||||
|
||||
if (mesh.GetDimension() == 3 || rational)
|
||||
@ -2239,6 +2241,20 @@ namespace netgen
|
||||
|
||||
switch (el.GetType())
|
||||
{
|
||||
case TRIG6:
|
||||
{
|
||||
AutoDiff<2,T> lam3 = 1-x-y;
|
||||
AutoDiff<2,T> lami[6] = { x * (2*x-1), y * (2*y-1), lam3 * (2*lam3-1),
|
||||
4 * y * lam3, 4 * x * lam3, 4 * x * y };
|
||||
for (int j = 0; j < 6; j++)
|
||||
{
|
||||
Point<3> p = mesh[el[j]];
|
||||
for (int k = 0; k < DIM_SPACE; k++)
|
||||
mapped_x[k] += p(k) * lami[j];
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case TRIG:
|
||||
{
|
||||
// if (info.order >= 2) return false; // not yet supported
|
||||
|
@ -33,6 +33,7 @@ class CurvedElements
|
||||
bool rational;
|
||||
|
||||
bool ishighorder;
|
||||
void buildJacPols();
|
||||
|
||||
public:
|
||||
DLL_HEADER CurvedElements (const Mesh & amesh);
|
||||
@ -50,6 +51,8 @@ public:
|
||||
|
||||
virtual void DoArchive(Archive& ar)
|
||||
{
|
||||
if(ar.Input())
|
||||
buildJacPols();
|
||||
ar & edgeorder & faceorder & edgecoeffsindex & facecoeffsindex & edgecoeffs & facecoeffs
|
||||
& edgeweight & order & rational & ishighorder;
|
||||
}
|
||||
|
@ -90,6 +90,7 @@ namespace netgen
|
||||
|
||||
Mesh & Mesh :: operator= (const Mesh & mesh2)
|
||||
{
|
||||
dimension = mesh2.dimension;
|
||||
points = mesh2.points;
|
||||
// eltyps = mesh2.eltyps;
|
||||
segments = mesh2.segments;
|
||||
@ -1320,6 +1321,7 @@ namespace netgen
|
||||
archive & segments;
|
||||
archive & facedecoding;
|
||||
archive & materials & bcnames & cd2names & cd3names;
|
||||
archive & numvertices;
|
||||
|
||||
archive & *ident;
|
||||
|
||||
@ -4995,6 +4997,10 @@ namespace netgen
|
||||
// netgen::Point<3> pmin = p - Vec<3> (pointtol, pointtol, pointtol);
|
||||
// netgen::Point<3> pmax = p + Vec<3> (pointtol, pointtol, pointtol);
|
||||
|
||||
if ( (dimension == 2 && !GetNSE()) ||
|
||||
(dimension == 3 && !GetNE() && !GetNSE()) )
|
||||
return -1;
|
||||
|
||||
if (dimension == 2 || (dimension==3 && !GetNE() && GetNSE()))
|
||||
{
|
||||
int ne;
|
||||
|
@ -1140,6 +1140,7 @@ namespace netgen
|
||||
default: break;
|
||||
cerr << "Element::SetType unknown type " << int(typ) << endl;
|
||||
}
|
||||
is_curved = (np > 4);
|
||||
}
|
||||
|
||||
|
||||
|
@ -765,11 +765,12 @@ namespace netgen
|
||||
void DoArchive (Archive & ar)
|
||||
{
|
||||
short _np, _typ;
|
||||
bool _curved;
|
||||
if (ar.Output())
|
||||
{ _np = np; _typ = typ; }
|
||||
ar & _np & _typ & index;
|
||||
{ _np = np; _typ = typ; _curved = is_curved; }
|
||||
ar & _np & _typ & index & _curved;
|
||||
if (ar.Input())
|
||||
{ np = _np; typ = ELEMENT_TYPE(_typ); }
|
||||
{ np = _np; typ = ELEMENT_TYPE(_typ); is_curved = _curved; }
|
||||
for (size_t i = 0; i < np; i++)
|
||||
ar & pnum[i];
|
||||
}
|
||||
|
@ -745,6 +745,38 @@ namespace netgen
|
||||
|
||||
MPI_Barrier(comm);
|
||||
|
||||
PrintMessage( 3, "Clean up local memory");
|
||||
|
||||
auto & self = const_cast<Mesh&>(*this);
|
||||
self.points = T_POINTS(0);
|
||||
self.surfelements = T_SURFELEMENTS(0);
|
||||
self.volelements = T_VOLELEMENTS(0);
|
||||
self.segments = Array<Segment, 0, size_t>(0);
|
||||
self.lockedpoints = Array<PointIndex>(0);
|
||||
auto cleanup_ptr = [](auto & ptr) {
|
||||
if (ptr != nullptr) {
|
||||
delete ptr;
|
||||
ptr = nullptr;
|
||||
}
|
||||
};
|
||||
cleanup_ptr(self.boundaryedges);
|
||||
cleanup_ptr(self.boundaryedges);
|
||||
cleanup_ptr(self.segmentht);
|
||||
cleanup_ptr(self.surfelementht);
|
||||
self.openelements = Array<Element2d>(0);
|
||||
self.opensegments = Array<Segment>(0);
|
||||
self.numvertices = 0;
|
||||
self.mlbetweennodes = Array<PointIndices<2>,PointIndex::BASE> (0);
|
||||
self.mlparentelement = Array<int>(0);
|
||||
self.mlparentsurfaceelement = Array<int>(0);
|
||||
self.topology.Update();
|
||||
self.curvedelems = new CurvedElements (self);
|
||||
self.clusters = new AnisotropicClusters (self);
|
||||
self.ident = new Identifications (self);
|
||||
self.BuildElementSearchTree();
|
||||
|
||||
// const_cast<Mesh&>(*this).DeleteMesh();
|
||||
|
||||
PrintMessage( 3, "send mesh complete");
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,8 @@ namespace netgen
|
||||
{
|
||||
extern bool netgen_executable_started;
|
||||
extern shared_ptr<NetgenGeometry> ng_geometry;
|
||||
extern void Optimize2d (Mesh & mesh, MeshingParameters & mp);
|
||||
|
||||
#ifdef PARALLEL
|
||||
/** we need allreduce in python-wrapped communicators **/
|
||||
template <typename T>
|
||||
@ -865,13 +867,20 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
|
||||
},
|
||||
py::arg("mp")=NGDummyArgument(),py::call_guard<py::gil_scoped_release>())
|
||||
|
||||
.def ("OptimizeVolumeMesh", FunctionPointer
|
||||
([](Mesh & self)
|
||||
.def ("OptimizeVolumeMesh", [](Mesh & self)
|
||||
{
|
||||
MeshingParameters mp;
|
||||
mp.optsteps3d = 5;
|
||||
OptimizeVolume (mp, self);
|
||||
}),py::call_guard<py::gil_scoped_release>())
|
||||
},py::call_guard<py::gil_scoped_release>())
|
||||
|
||||
.def ("OptimizeMesh2d", [](Mesh & self)
|
||||
{
|
||||
self.CalcLocalH(0.5);
|
||||
MeshingParameters mp;
|
||||
mp.optsteps2d = 5;
|
||||
Optimize2d (self, mp);
|
||||
},py::call_guard<py::gil_scoped_release>())
|
||||
|
||||
.def ("Refine", FunctionPointer
|
||||
([](Mesh & self)
|
||||
@ -975,12 +984,17 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
|
||||
},
|
||||
py::arg("name"), py::arg("set")=true)
|
||||
|
||||
.def ("Scale", FunctionPointer([](Mesh & self, double factor)
|
||||
{
|
||||
for(auto i = 0; i<self.GetNP();i++)
|
||||
self.Point(i).Scale(factor);
|
||||
}))
|
||||
|
||||
.def ("Scale", [](Mesh & self, double factor)
|
||||
{
|
||||
for(auto i = 0; i<self.GetNP();i++)
|
||||
self.Point(i).Scale(factor);
|
||||
})
|
||||
.def ("Copy", [](Mesh & self)
|
||||
{
|
||||
auto m2 = make_shared<Mesh> ();
|
||||
*m2 = self;
|
||||
return m2;
|
||||
})
|
||||
;
|
||||
|
||||
m.def("ImportMesh", [](const string& filename)
|
||||
|
@ -4005,8 +4005,8 @@ namespace netgen
|
||||
Array<int> compress(n3);
|
||||
|
||||
NgProfiler::StartTimer (timer_vals);
|
||||
Array<double,PointIndex::BASE> vertval(mesh->GetNV());
|
||||
Array<bool,PointIndex::BASE> posval(mesh->GetNV());
|
||||
Array<double,PointIndex::BASE> vertval(mesh->GetNP());
|
||||
Array<bool,PointIndex::BASE> posval(mesh->GetNP());
|
||||
for (PointIndex pi = vertval.Begin(); pi < vertval.End(); pi++)
|
||||
{
|
||||
Point<3> vert = (*mesh)[pi];
|
||||
|
6
tests/build_mpi.sh
Normal file
6
tests/build_mpi.sh
Normal file
@ -0,0 +1,6 @@
|
||||
cd
|
||||
mkdir -p build/netgen
|
||||
cd build/netgen
|
||||
cmake ../../src/netgen -DUSE_CCACHE=ON -DUSE_MPI=ON
|
||||
make -j12
|
||||
make install
|
5
tests/dockerfile_mpi
Normal file
5
tests/dockerfile_mpi
Normal file
@ -0,0 +1,5 @@
|
||||
FROM ubuntu:18.04
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
MAINTAINER Matthias Hochsteger <matthias.hochsteger@tuwien.ac.at>
|
||||
RUN apt-get update && apt-get -y install python3 libpython3-dev libxmu-dev tk-dev tcl-dev cmake git g++ libglu1-mesa-dev ccache python3-pytest python3-numpy python3-tk clang-tidy python3-distutils clang libopenmpi-dev openmpi-bin gfortran
|
||||
ADD . /root/src/netgen
|
Loading…
Reference in New Issue
Block a user