I have isolated the error to minimum (not-) working example: The error
occurs
when Point and Boost functions are used at once in a dealii program.
I have observed that in the Point class there is usage of some boost
functions,
could it be that there is clash with that boost version and the below
combing
from the boost include file?
usingBoostindealii.cc :
#include <boost/math/special_functions/spherical_harmonic.hpp>
#include <iostream>
#include <vector>
#include <cmath>
#include <deal.II/grid/tria.h>
#include <deal.II/grid/grid_generator.h>
#include <deal.II/grid/tria_accessor.h>
#include <deal.II/grid/tria_iterator.h>
#include <deal.II/fe/fe_values.h>
#include <deal.II/fe/fe_nothing.h>
#include <deal.II/base/quadrature_lib.h>
#include <deal.II/base/timer.h>
using namespace dealii;
int main()
{
Point<3> evalPoint(1.0, 2.0, 0.0);
Point<3> evalPoint2(1.0, 1.0, 1.0);
std::vector<double> atomPos{0.0, 0.0, 0.0};
std::cout << evalPoint.distance_square(evalPoint2) << '\n'; // comment this
to test the below too
double sphericalHarmonicVal{};
double r{}, theta{}, phi{};
// std::vector<double> relativeEvalPoint(3, 0.0);
// // *** even with the below there is same error ***
// for (int i = 0; i < 3; ++i)
// {
// relativeEvalPoint[i] = evalPoint(i) - atomPos[i];
// // relativeEvalPoint[i] = evalPoint[i] - atomPos[i];
// }
sphericalHarmonicVal = boost::math::spherical_harmonic_i(0, 0, 0.0, 0.0);
std::cout << sphericalHarmonicVal << '\n';
return 0;
}
CMakeLists.txt :
##
# CMake script for the usingBoostindealii program:
##
# Set the name of the project and target:
SET(TARGET "usingBoostindealii")
# Declare all source files the target consists of. Here, this is only
# the one step-X.cc file, but as you expand your project you may wish
# to add other source files as well. If your project becomes much larger,
# you may want to either replace the following statement by something like
# FILE(GLOB_RECURSE TARGET_SRC "source/*.cc")
# FILE(GLOB_RECURSE TARGET_INC "include/*.h")
# SET(TARGET_SRC ${TARGET_SRC} ${TARGET_INC})
# or switch altogether to the large project CMakeLists.txt file discussed
# in the "CMake in user projects" page accessible from the "User info"
# page of the documentation.
SET(TARGET_SRC
${TARGET}.cc
)
# Usually, you will not need to modify anything beyond this point...
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)
# FIND_PACKAGE(Boost REQUIRED)
FIND_PACKAGE(deal.II 9.2.0 QUIET
HINTS ${deal.II_DIR} ${DEAL_II_DIR} ../ ../../ $ENV{DEAL_II_DIR}
)
IF(NOT ${deal.II_FOUND})
MESSAGE(FATAL_ERROR "\n"
"*** Could not locate a (sufficiently recent) version of deal.II.
***\n\n"
"You may want to either pass a flag -DDEAL_II_DIR=/path/to/deal.II to
cmake\n"
"or set an environment variable \"DEAL_II_DIR\" that contains this
path."
)
ENDIF()
DEAL_II_INITIALIZE_CACHED_VARIABLES()
PROJECT(${TARGET})
DEAL_II_INVOKE_AUTOPILOT()
Best wishes,
Kishore
On Friday, May 14, 2021 at 9:49:52 PM UTC+5:30 Kishore Nori wrote:
> Dear Prof. Bangerth,
>
> Thank you for the reply, yes I was having some doubt on this. I removed
> the
> FIND_PACKAGE(Boost REQUIRED) in CMakeLists.txt but I still get the error.
>
> Could it be because of the boost include file? #include
> <boost/math/special_functions/spherical_harmonic.hpp>
> Does deal.II come with boost library included? If yes, how can I use it
> for the access the above function?
>
> Best wishes,
>
> Kishore
>
> On Friday, May 14, 2021 at 9:24:58 PM UTC+5:30 Wolfgang Bangerth wrote:
>
>> On 5/14/21 8:17 AM, Bruno Turcksin wrote:
>> >
>> > Can you show the result of the command ldd, i.e. what do you see when
>> you type
>> > ldd ./my_code
>>
>> Could it be that you are linking against both the version of BOOST that
>> comes
>> with deal.II and against an external one? That would explain why things
>> already go wrong while starting up the program. Try removing the
>> FindBOOST
>> call from your own project's CMakeLists.txt.
>>
>> Best
>> W.
>>
>>
>> --
>> ------------------------------------------------------------------------
>> Wolfgang Bangerth email: [email protected]
>> www: http://www.math.colostate.edu/~bangerth/
>>
>>
--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see
https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/dealii/bf6946b0-8a7f-4c54-9c4a-efaf1bfafd59n%40googlegroups.com.