Giter Site home page Giter Site logo

Compilation problem about scattnlay HOT 20 OPEN

inzhevatkin avatar inzhevatkin commented on June 26, 2024
Compilation problem

from scattnlay.

Comments (20)

kostyfisik avatar kostyfisik commented on June 26, 2024

I have no Windows box to check, may be @ovidiopr can comment on this.

from scattnlay.

ovidiopr avatar ovidiopr commented on June 26, 2024

from scattnlay.

kostyfisik avatar kostyfisik commented on June 26, 2024

Or you can check online Mie calculator based on Scattnlay (I have exposed only small part of API, however, it can be handy for simple computations) https://physics.ifmo.ru/mie/

from scattnlay.

kostyfisik avatar kostyfisik commented on June 26, 2024

Or you can also try MinGW http://www.mingw.org/ I have no experience with it, but I know that it is a popular alternative to Visual C++. You may also check https://kezunlin.me/post/8b9c051d/ (it is about building with pybind11 on windows, and we use pybind11 to interface C++ and Python code).

from scattnlay.

inzhevatkin avatar inzhevatkin commented on June 26, 2024

Thanks for the quick response.
Thanks for the valuable advices.

I did not write right away, but I am using MinGw and plan to compile it using the gcc or g++ built-in compiler.

I want to find electrical field in space with Scattnlay project and I understood that API https://physics.ifmo.ru/mie/ has not this such an opportunity or functionality. But this advice is very valuable for future tasks.

I understand that the Makefie in the project is not intended for assembly in Windows. Is it so?

I will try to read in more detail the links that you advised.

from scattnlay.

kostyfisik avatar kostyfisik commented on June 26, 2024

from scattnlay.

inzhevatkin avatar inzhevatkin commented on June 26, 2024

Hello.

I have not yet succeeded with the make ext command.
My latest achievement is the following:

  1. Run make ext command.
    Output:
    '/c/Users/konstantin/AppData/Local/Programs/Python/Python37-32/python.exe' setup.py build_ext --inplace
    running build_ext
    Traceback (most recent call last):
    File "setup.py", line 81, in
    extra_compile_args=['-std=c++11', '-DMULTI_PRECISION=100'])]
    File "c:\Users\konstantin\AppData\Local\Programs\Python\Python37-32\lib\distutils\core.py", line 148, in setup
    dist.run_commands()
    File "c:\Users\konstantin\AppData\Local\Programs\Python\Python37-32\lib\distutils\dist.py", line 966, in run_commands
    self.run_command(cmd)
    File "c:\Users\konstantin\AppData\Local\Programs\Python\Python37-32\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
    File "c:\Users\konstantin\AppData\Local\Programs\Python\Python37-32\lib\distutils\command\build_ext.py", line 309, in run
    force=self.force)
    File "c:\Users\konstantin\AppData\Local\Programs\Python\Python37-32\lib\distutils\ccompiler.py", line 1031, in new_compiler
    return klass(None, dry_run, force)
    File "c:\Users\konstantin\AppData\Local\Programs\Python\Python37-32\lib\distutils\cygwinccompiler.py", line 282, in init
    CygwinCCompiler.init (self, verbose, dry_run, force)
    File "c:\Users\konstantin\AppData\Local\Programs\Python\Python37-32\lib\distutils\cygwinccompiler.py", line 157, in init
    self.dll_libraries = get_msvcr()
    File "c:\Users\konstantin\AppData\Local\Programs\Python\Python37-32\lib\distutils\cygwinccompiler.py", line 86, in get_msvcr
    raise ValueError("Unknown MS Compiler version %s " % msc_ver)
    ValueError: Unknown MS Compiler version 1916
    make: *** [ext] Error 1

I can't tell python distutils to use mingw.

I also wanted to inform you that I use code from master branch and I tried to compile project on my laptop with make standalone command and I found some problems:

  1. Makefile has line PYTHON='which python3'. In my case I have to use exact path to python.exe.
  2. I run make standalone command.
    Output:
    make: *** No rule to make target /c/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nmie-impl.hpp', needed by scattnlay'. Stop.
    There is no file (nmie-impl.hpp) in the project.
  3. I deleted $(SRCDIR)/nmie-impl.hpp in Makefile and compiled with make standalone command.
    Output:
    g++ -DNDEBUG -O2 -Wall -std=c++11 /c/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nearfield.cc /c/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nmie.cc -lm -o fieldnlay
    In file included from c:/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nearfield.cc:43:
    c:/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nmie.hpp:40:10: fatal error: boost/math/constants/constants.hpp: No such file or directory
    #include <boost/math/constants/constants.hpp>
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    compilation terminated.
    In file included from c:/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nmie.cc:48:
    c:/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nmie.hpp:40:10: fatal error: boost/math/constants/constants.hpp: No such file or directory
    #include <boost/math/constants/constants.hpp>
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    compilation terminated.
    make: *** [fieldnlay] Error 1_
  4. I deleted scattnlay-mp fieldnlay-mp in Makefile and #include <boost/math/constants/constants.hpp> in nmie.hpp. At the moment I will deal with the project without a library if possible.
    No errors occurred.
    Output:
    g++ -DNDEBUG -O2 -Wall -std=c++11 /c/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/farfield.cc /c/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nmie.cc -lm -o scattnlay
    g++ -DNDEBUG -O2 -Wall -std=c++11 /c/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nearfield.cc /c/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nmie.cc -lm -o fieldnlay

    In project folder I have fieldnlay.exe and scattnlay.exe.

Can I use this file to calculate the electrical field? In the examples I saw only scattnlay functions from python library.
I apologize for the long comment.

from scattnlay.

kostyfisik avatar kostyfisik commented on June 26, 2024

from scattnlay.

inzhevatkin avatar inzhevatkin commented on June 26, 2024

Yes, I have the same output:
Invalid argument: Insufficient parameters.
Usage: fieldnlay.exe -l Layers x1 m1.r m1.i [x2 m2.r m2.i ...] -p xi xf nx yi yf ny zi zf nz [-c comment].

For test I tried to run command fieldnlay.exe -l Layers 10 1.01 0 -p -5 5 1 -5 5 1 -5 5 1.
Error occurred in line L = std::stoi(arg); in nearfield.cc, arg was "Layers" and it threw an exception. I deleted this line and manually defined L = 1. It outputs field values to consol. Perfect! Thank you!

Logically, the variable L should store the number of layers, but I did not understand how this is implemented programmatically. Maybe I didn’t understand something. In my case, I need a homogeneous sphere without layers.

I just still did not catch how to do it:

I would propose to try to install python package (python-scattnlay), as
soon as it is much more convenient to calculate near-field using python
interface. At least calling scattnlay from python is a default way I use
it.

from scattnlay.

ovidiopr avatar ovidiopr commented on June 26, 2024

from scattnlay.

ovidiopr avatar ovidiopr commented on June 26, 2024

from scattnlay.

ovidiopr avatar ovidiopr commented on June 26, 2024

from scattnlay.

ovidiopr avatar ovidiopr commented on June 26, 2024

from scattnlay.

inzhevatkin avatar inzhevatkin commented on June 26, 2024

Thank you very much I will try to do what you advised.

from scattnlay.

ovidiopr avatar ovidiopr commented on June 26, 2024

from scattnlay.

inzhevatkin avatar inzhevatkin commented on June 26, 2024

I tried this:

fieldnlay.exe -l 10 1.01 0 -p -5 5 1 -5 5 1 -5 5 1

It doesn't work in my case. It returns:
Invalid argument: Unfinished layer!
Insufficient parameters.

from scattnlay.

ovidiopr avatar ovidiopr commented on June 26, 2024

from scattnlay.

inzhevatkin avatar inzhevatkin commented on June 26, 2024

I suspect that some parameters were missing. An example of the command line when everything is OK in the calculation fields:
fieldnlay.exe -l 1 10 1.01 0 -p -5 5 1 -5 5 1 -5 5 1

from scattnlay.

ovidiopr avatar ovidiopr commented on June 26, 2024

from scattnlay.

kostyfisik avatar kostyfisik commented on June 26, 2024

@ovidiopr May be we need provide a copy of needed boost files, as soon as we really need just a tiny part of boostlib...

from scattnlay.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.