Dear group,
I apologize if my question below has already been addressed in the one of
deal.ii’s documentation resources, but I didn't understand how to answer it
using the pieces of documentation that I have read such as
“How to use CMake to configure your projects with deal.II”
https://www.dealii.org/developer/users/cmakelists.html#cmakeauto
and
“deal.II in Spack” https://github.com/dealii/dealii/wiki/deal.II-in-Spack
I am trying to embed a short Python script in my code, but get an error
message after running “make release”. Attached are an example code with a
minor addition to the “main” of Step-1 and the “CMakeLists.txt” file that I
tried to adapt to support Python.
I am running my code on a MAC OS Yosemite 10.10.5 with the special version
of deal.ii that Luca prepared for me
https://groups.google.com/forum/#!searchin/dealii/%22Make$20test%22$20failure$20following$20Trilinos$20installation$20with$20Mesquite%7Csort:relevance/dealii/Y7MH_BE0yko/1zvnHGR7AQAJ
<https://groups.google.com/forum/%23!searchin/dealii/%22Make$20test%22$20failure$20following$20Trilinos$20installation$20with$20Mesquite%7Csort:relevance/dealii/Y7MH_BE0yko/1zvnHGR7AQAJ>
Here are the error messages that I get:
[ yaakobioy L02029080
~/dealii/dealii-8-5-0pre-v2/dealii-8-5-0pre-v2-Install/examples/step-1-mod
]$ make release
CMake Error at
/Users/yaakobioy/dealii/dealii-8-5-0pre-v2/dealii-8-5-0pre-v2-Install/share/deal.II/macros/macro_deal_ii_invoke_autopilot.cmake:57
(ADD_EXECUTABLE):
add_executable cannot create target "step-1" because another target with
the same name already exists. The existing target is an executable
created
in source directory
"/Users/yaakobioy/dealii/dealii-8-5-0pre-v2/dealii-8-5-0pre-v2-Install/examples/step-1-mod".
See documentation for policy CMP0002 for more details.
Call Stack (most recent call first):
CMakeLists.txt:49 (DEAL_II_INVOKE_AUTOPILOT)
-- Configuring incomplete, errors occurred!
See also
"/Users/yaakobioy/dealii/dealii-8-5-0pre-v2/dealii-8-5-0pre-v2-Install/examples/step-1-mod/CMakeFiles/CMakeOutput.log".
make: *** [cmake_check_build_system] Error 1
I would appreciate if someone could explain what should I do to overcome
this problem.
Thanks in advance,
Oded
--
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].
For more options, visit https://groups.google.com/d/optout.
/* ---------------------------------------------------------------------
*
* Copyright (C) 1999 - 2015 by the deal.II authors
*
* This file is part of the deal.II library.
*
* The deal.II library is free software; you can use it, redistribute
* it, and/or modify it under the terms of the GNU Lesser General
* Public License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* The full text of the license can be found in the file LICENSE at
* the top level of the deal.II distribution.
*
* ---------------------------------------------------------------------
*/
#include <Python/Python.h>
#include <deal.II/grid/tria.h>
#include <deal.II/grid/tria_accessor.h>
#include <deal.II/grid/tria_iterator.h>
#include <deal.II/grid/grid_generator.h>
#include <deal.II/grid/manifold_lib.h>
#include <deal.II/grid/grid_out.h>
#include <iostream>
#include <fstream>
#include <cmath>
using namespace dealii;
void first_grid ()
{
Triangulation<2> triangulation;
GridGenerator::hyper_cube (triangulation);
triangulation.refine_global (4);
std::ofstream out ("grid-1.eps");
GridOut grid_out;
grid_out.write_eps (triangulation, out);
std::cout << "Grid written to grid-1.eps" << std::endl;
}
void second_grid ()
{
Triangulation<2> triangulation;
const Point<2> center (1,0);
const double inner_radius = 0.5,
outer_radius = 1.0;
GridGenerator::hyper_shell (triangulation,
center, inner_radius, outer_radius,
10);
triangulation.set_all_manifold_ids(0);
const SphericalManifold<2> manifold_description(center);
triangulation.set_manifold (0, manifold_description);
for (unsigned int step=0; step<5; ++step)
{
Triangulation<2>::active_cell_iterator
cell = triangulation.begin_active(),
endc = triangulation.end();
for (; cell!=endc; ++cell)
{
for (unsigned int v=0;
v < GeometryInfo<2>::vertices_per_cell;
++v)
{
const double distance_from_center
= center.distance (cell->vertex(v));
if (std::fabs(distance_from_center - inner_radius) < 1e-10)
{
cell->set_refine_flag ();
break;
}
}
}
triangulation.execute_coarsening_and_refinement ();
}
std::ofstream out ("grid-2.eps");
GridOut grid_out;
grid_out.write_eps (triangulation, out);
std::cout << "Grid written to grid-2.eps" << std::endl;
triangulation.set_manifold (0);
}
int main ()
{
Py_Initialize();
PyRun_SimpleString("from time import time,ctime\n"
"print('Today is', ctime(time()))\n");
Py_Finalize();
first_grid ();
second_grid ();
}
##
# CMake script for the step-1 tutorial program:
##
# Set the name of the project and target:
SET(TARGET "step-1")
# 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.8)
FIND_PACKAGE(deal.II 8.5.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})
find_package(PythonLibs REQUIRED)
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_DIRS})
ADD_EXECUTABLE(${TARGET} ${TARGET}.cc)
DEAL_II_SETUP_TARGET(${TARGET})
TARGET_LINK_LIBRARIES(${TARGET} ${PYTHON_LIBRARIES})
DEAL_II_INVOKE_AUTOPILOT()