installing ngsxfem

Hello there,

I have been using Ngsolve for a while now and I have decided to install xfem extension to it. I am following the steps explained under downloads but when I do

cmake …/ -DCMAKE_INSTALL_PREFIX=INSTLOCATION -DBUILD_NGSOLVE=ON

I keep getting

CMake Error: The source directory “/home” does not appear to contain CMakeLists.txt.

anyone has experienced this before?

Thanks…

Hello noname,

It seems that you call that command in your home directory while the sources are not in /home but somewhere else.
In the installation instructions it says that you should do

git clone https://github.com/ngsxfem/ngsxfem.git cd ngsxfem mkdir build cd build

before executing the cmake-command. Note that you are in a build directory then and …/ refers to the source of ngsxfem so that cmake can find the CMakeLists.txt file.

Please check where you downloaded ngsxfem and make sure that you refer to the correct source directory. Then try again.

Best,
Christoph

Hello again, thanks for the fast reply. Followed your advice and advanced a bit, now when I do

make

I got

/usr/include/netgen/nginterface.h:315:5: error: ‘string’ does not name a type; did you mean ‘stdin’?
string name; // name of gridfunction

You are using BUILD_NGSOLVE=ON, right? That means that NGSolve and netgen etc. are also installed. For that you need to make sure that you do a

git submodule update --init

Did you do that?

It is also advisable to uninstall NGSolve beforehand (or make invisible for CMake) so that the NGSolve versions (one that you have installed through binaries as it seems and one that ngsxfem tries to install himself) don’t mix up.

If you still have problems can you post a chain of commands that you applied so that I can try to understand what is going on on your machine?

Best,
Christoph

Hello,

I am quite new to this so if the answers to my questions are obvious, excuse me.

Since I already have Ngsolve installed , I run
( after cloning the xfem library, but I am not sure where to clone this, it can be anywhere? it needs to be where NGsolve is?? )

cmake …/ -DCMAKE_INSTALL_PREFIX=INSTLOCATION -DBUILD_NGSOLVE=OFF
make
make install

but after running the “cmake …/ -DCMAKE_INSTALL_PREFIX=INSTLOCATION -DBUILD_NGSOLVE=OFF” I run “make”, and that is where I get the error

/usr/include/netgen/nginterface.h:315:5: error: ‘string’ does not name a type; did you mean ‘stdin’?
string name; // name of gridfunction

My suspicion is that I am setting the INSTLOCATION wrong, it needs to be where NGsolve is installed and I searched for it in my computer but not sure if I found the right place.

Hi,

  1. It depends on the versions of ngsxfem that you check out and the version of NGSolve that you have installed if they are compatible at all. The save way to do it, is to update the submodules (see post before) use -DBUILD_NGSOLVE=ON in the cmake-options and deinstall ngsolve beforehand. Then the submodule of a compatible NGSolve-version is taken. The price you pay is that it will probably take quite long to compile through everything. What is your NGSolve version? What is your ngsxfem version (date)?

  2. Where you put the sources of ngsxfem to is up to you. The location where it is installed to is set by the INSTLOCATION which you can decide on, but you have to make sure that the environment variables are set so that the installed files can be found by your OS.

  3. If the INSTLOCATION is set wrongly this is only to be noticed after the installation. The installation should go through also with a wrong INSTLOCATION.

Hi,

I have uninstalled netgen and on my Desktop did,

git clone GitHub - ngsxfem/ngsxfem: Add-On to NGSolve for unfitted finite element discretizations (XFEM, CutFEM, TraceFEM, etc...)
cd ngsxfem
mkdir build
cd build

and

cmake …/ -DCMAKE_INSTALL_PREFIX=INSTLOCATION -DBUILD_NGSOLVE=ON
after running a while I got the following error message now,

Could not find a package configuration file provided by “NGSolve” with any
of the following names:

NGSolveConfig.cmake
ngsolve-config.cmake

Add the installation prefix of “NGSolve” to CMAKE_PREFIX_PATH or set
“NGSolve_DIR” to a directory containing one of the above files. If
“NGSolve” provides a separate development package or SDK, be sure it has
been installed.

– Configuring incomplete, errors occurred!
See also “/home/~/Desktop/ngsxfem/build/CMakeFiles/CMakeOutput.log”.

If you know what this is, it would be superb, thanks in advance…

Did you do the

git submodule update --init --recursive

after the clone and before the cmake-call?

Furthermore “INSTLOCATION” should be replaced with the location that you want ngsxfem to be installed to.

If this doesn’t work you try adding “-DCMAKE_PREFIX_PATH=INSTLOCATION” to the cmake command (although this should ideally not be necessary).

Best,
Christoph

Hi,

I am following your exact commands in the exact order, I even added “-DCMAKE_PREFIX_PATH=INSTLOCATION” to the cmake command as you suggested but the same error continues…

Little updates,

I have found where the NGSolveConfig.cmake is and changed the NGSolve_DIR in CMakeCache.txt to that directory.

Now I get the following error when I re-do the
cmake …/ -DCMAKE_INSTALL_PREFIX=INSTLOCATION -DBUILD_NGSOLVE=ON

/home/~/Desktop/cutfem-cutdg/cutfem-nse-moving-domains-2018/ngsxfem/external_dependencies/ngsolve/comp/pde.cpp:8:10: fatal error: tcl.h: No such file or directory
#include <tcl.h>
^~~~~~~
compilation terminated.
comp/CMakeFiles/ngcomp.dir/build.make:782: recipe for target ‘comp/CMakeFiles/ngcomp.dir/pde.cpp.o’ failed
make[5]: *** [comp/CMakeFiles/ngcomp.dir/pde.cpp.o] Error 1
CMakeFiles/Makefile2:501: recipe for target ‘comp/CMakeFiles/ngcomp.dir/all’ failed
make[4]: *** [comp/CMakeFiles/ngcomp.dir/all] Error 2
Makefile:140: recipe for target ‘all’ failed
make[3]: *** [all] Error 2
CMakeFiles/ngsolve.dir/build.make:115: recipe for target ‘dependencies/Stamp/ngsolve/ngsolve-build’ failed
make[2]: *** [dependencies/Stamp/ngsolve/ngsolve-build] Error 2
CMakeFiles/Makefile2:211: recipe for target ‘CMakeFiles/ngsolve.dir/all’ failed
make[1]: *** [CMakeFiles/ngsolve.dir/all] Error 2
Makefile:151: recipe for target ‘all’ failed
make: *** [all] Error 2
– Found Netgen: /home/~/Desktop/cutfem-cutdg/cutfem-nse-moving-domains-2018/lib/cmake/netgen
CMake Error at build/ngsolve/ngsolve/NGSolveConfig.cmake:64 (include):
include could not find load file:

/home/~/Desktop/cutfem-cutdg/cutfem-nse-moving-domains-2018/ngsxfem/build/ngsolve/ngsolve/ngsolve-targets.cmake

Call Stack (most recent call first):
CMakeLists.txt:64 (find_package)

– Found PythonInterp: /usr/bin/python3 (found suitable version “3.6.7”, minimum required is “3”)
– Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython3.6m.so (found suitable version “3.6.7”, minimum required is “3”)


xfem 1.0.0-dev: Automatic configuration OK.

Install directory:
/home/~/Desktop/cutfem-cutdg/cutfem-nse-moving-domains-2018/ngsxfem/build/INSTLOCATION

Compiler:
CMAKE_CXX_COMPILER = /usr/bin/c++

Compiler Flags:
flags = -O2 -g -DNDEBUG

Generator:
Unix Makefiles

Build Type:
type = RELWITHDEBINFO

Build NGSolve from scratch: ON
Build xfem (and NGSolve) with ccache: OFF

Building:

Type 'make' to compile xfem.

Type 'make install' to install xfem.

More updates…

To solve the above problem in the related file I have changed the tcl.h to tcl/tcl.h, turns out that Ubuntu places tcl.h in /usr/include/tcl/ not in usr/include.

Now I have
– Configuring done
– Generating done

but then when I make
make

I get

fatal error: ngstd.hpp: No such file or directory

There are a few prerequisites for ngsolve to be built from source, see also

https://ngsolve.org/docu/latest/install/installlinux.html

Please install them beforehand. Also: Can you please post the full list of commands and subsequent output in your installation (note that you can also attach text files here).

Best,
Christoph

Hello,

To wrap up this, at the end although I installed all the prerequisites and uninstalled my
existing ngsolve and followed your instructions in correct order to install ngsolve and ngsxfem together I could not sucsess. It gave me bunch of weird error messages starting from the

Could not find a package configuration file provided by “NGSolve” with any
of the following names:

NGSolveConfig.cmake
ngsolve-config.cmake

Add the installation prefix of “NGSolve” to CMAKE_PREFIX_PATH or set
“NGSolve_DIR” to a directory containing one of the above files. If
“NGSolve” provides a separate development package or SDK, be sure it has
been installed.

message. I solved them one by one and finished the install at the end but ngsolve was not running, seems like there was something wrong with the paths.
I am using Ubuntu 18.04.

At the end I seperately installed ngsolve 6.2.1901 and get acsess to developer version of ngsxfem and installed that, that worked.

Thanks for all your help.