Dear all,
I am currently working on an analysis thorn which makes use of different quantities provided by the thorn ADMMacros. In one .cc file I assemble different routines. Especialy, one of those uses UPPERMET, and another one uses TRRICCI.
Using the declaration and definition from the thorn documentation, I made sure to correctly employ the includes of _declare, _guts, and, _undefine.
However, when compiling I keep receiving the following error:
In file included from /scratch/je/jensflo/EinsteinTools/Cactus/arrangements/EinsteinBase/ADMMacros/src/macro/UPPERMET_guts.h(14), from /scratch/je/jensflo/EinsteinTools/Cactus/arrangements/EinsteinBase/ADMMacros/src/macro/TRRICCI_guts.h(15), from /scratch/je/jensflo/EinsteinTools/Cactus/configs/sim/build/FFEvolve/FFEvolve_Analysis.cc(412): /scratch/je/jensflo/EinsteinTools/Cactus/arrangements/EinsteinBase/ADMMacros/src/macro/DETG_guts.h(36): error: identifier "detg_psi4" is undefined DETG_PSI4 = 1;
This error occurs for a variety of other identifiers in the same place. If I take out the TRRICCI part from the code, I do not get these error messages. I would be so glad about an insight into this.
Thank you so much and my best from Valencia
Jens
On 11 Jul 2017, at 09:42, Jens Mahlmann jensmahl@alumni.uv.es wrote:
Dear all,
I am currently working on an analysis thorn which makes use of different quantities provided by the thorn ADMMacros. In one .cc file I assemble different routines. Especialy, one of those uses UPPERMET, and another one uses TRRICCI.
Using the declaration and definition from the thorn documentation, I made sure to correctly employ the includes of _declare, _guts, and, _undefine.
However, when compiling I keep receiving the following error: In file included from /scratch/je/jensflo/EinsteinTools/Cactus/arrangements/EinsteinBase/ADMMacros/src/macro/UPPERMET_guts.h(14), from /scratch/je/jensflo/EinsteinTools/Cactus/arrangements/EinsteinBase/ADMMacros/src/macro/TRRICCI_guts.h(15), from /scratch/je/jensflo/EinsteinTools/Cactus/configs/sim/build/FFEvolve/FFEvolve_Analysis.cc(412): /scratch/je/jensflo/EinsteinTools/Cactus/arrangements/EinsteinBase/ADMMacros/src/macro/DETG_guts.h(36): error: identifier "detg_psi4" is undefined DETG_PSI4 = 1;
This error occurs for a variety of other identifiers in the same place. If I take out the TRRICCI part from the code, I do not get these error messages. I would be so glad about an insight into this. Thank you so much and my best from Valencia
Hi,
I have never used ADMMacros, but looking at the code, it looks like DETG_PSI4 is defined in DETG_declare.h, which also declares the variable it names (CCTK_REAL DETG_PSI4), and this header is included by UPPERMET_declare.h, which is included by TRRICCI_declare.h. So as far as I can see, if you include TRRICCI_declare.h, you should get the declaration of DETG_PSI4, which is detg_psi4.
One thing to check is that you have included the header files in your function, not at the top of the file with the other includes. Could you post your code, or a small cut down example which we can use to reproduce the problem?
Hi Ian!
in the following, I assembled an exemplary code reproducing the problem when compiling. I figured that making use of TRRICCI and UPPERMET in different files does not yield any problems. So for now I split up my routines to avoid this double declaration.
My best!
Jens
#include "cctk.h" #include "cctk_Arguments.h" #include "cctk_Parameters.h" #include "cctk_Functions.h"
#include <carpet.hh> #include "loopcontrol.h"
void FFEvolve_Test1 (CCTK_ARGUMENTS) { DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS;
int const ni = cctk_lsh[0]; int const nj = cctk_lsh[1]; int const nk = cctk_lsh[2]; int const np = cctk_ash[0] * cctk_ash[1] * cctk_ash[2];
const int di = 1; const int dj = cctk_lsh[0]; const int dk = cctk_lsh[0]*cctk_lsh[1]; #include "EinsteinBase/ADMMacros/src/macro/DA_declare.h" #include "EinsteinBase/ADMMacros/src/macro/UPPERMET_declare.h"
#pragma omp parallel { CCTK_LOOP3(test1, i, j, k, 0, 0, 0, ni , nj , nk , ni , nj , nk ) { CCTK_INT ijk;
ijk = CCTK_GFINDEX3D(cctkGH, i,j,k); #include "EinsteinBase/ADMMacros/src/macro/DA_guts.h" #include "EinsteinBase/ADMMacros/src/macro/UPPERMET_guts.h"
}CCTK_ENDLOOP3(test1); }
#include "EinsteinBase/ADMMacros/src/macro/UPPERMET_undefine.h" #include "EinsteinBase/ADMMacros/src/macro/DA_undefine.h"
}
void FFEvolve_Test2 (CCTK_ARGUMENTS) { DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS;
int const ni = cctk_lsh[0]; int const nj = cctk_lsh[1]; int const nk = cctk_lsh[2]; int const np = cctk_ash[0] * cctk_ash[1] * cctk_ash[2];
const int di = 1; const int dj = cctk_lsh[0]; const int dk = cctk_lsh[0]*cctk_lsh[1]; #include "EinsteinBase/ADMMacros/src/macro/TRRICCI_declare.h"
#pragma omp parallel { CCTK_LOOP3(test2, i, j, k, 0, 0, 0, ni , nj , nk , ni , nj , nk ) { CCTK_INT ijk;
ijk = CCTK_GFINDEX3D(cctkGH, i,j,k); #include "EinsteinBase/ADMMacros/src/macro/TRRICCI_guts.h"
}CCTK_ENDLOOP3(test1); }
#include "EinsteinBase/ADMMacros/src/macro/TRRICCI_undefine.h"
}
On 07/11/2017 11:09 AM, Ian Hinder wrote:
On 11 Jul 2017, at 09:42, Jens Mahlmann jensmahl@alumni.uv.es wrote:
Dear all,
I am currently working on an analysis thorn which makes use of different quantities provided by the thorn ADMMacros. In one .cc file I assemble different routines. Especialy, one of those uses UPPERMET, and another one uses TRRICCI.
Using the declaration and definition from the thorn documentation, I made sure to correctly employ the includes of _declare, _guts, and, _undefine.
However, when compiling I keep receiving the following error: In file included from /scratch/je/jensflo/EinsteinTools/Cactus/arrangements/EinsteinBase/ADMMacros/src/macro/UPPERMET_guts.h(14), from /scratch/je/jensflo/EinsteinTools/Cactus/arrangements/EinsteinBase/ADMMacros/src/macro/TRRICCI_guts.h(15), from /scratch/je/jensflo/EinsteinTools/Cactus/configs/sim/build/FFEvolve/FFEvolve_Analysis.cc(412): /scratch/je/jensflo/EinsteinTools/Cactus/arrangements/EinsteinBase/ADMMacros/src/macro/DETG_guts.h(36): error: identifier "detg_psi4" is undefined DETG_PSI4 = 1;
This error occurs for a variety of other identifiers in the same place. If I take out the TRRICCI part from the code, I do not get these error messages. I would be so glad about an insight into this. Thank you so much and my best from Valencia
Hi,
I have never used ADMMacros, but looking at the code, it looks like DETG_PSI4 is defined in DETG_declare.h, which also declares the variable it names (CCTK_REAL DETG_PSI4), and this header is included by UPPERMET_declare.h, which is included by TRRICCI_declare.h. So as far as I can see, if you include TRRICCI_declare.h, you should get the declaration of DETG_PSI4, which is detg_psi4.
One thing to check is that you have included the header files in your function, not at the top of the file with the other includes. Could you post your code, or a small cut down example which we can use to reproduce the problem?
On Tue, Jul 11, 2017 at 11:26:22AM +0200, Jens Mahlmann wrote:
in the following, I assembled an exemplary code reproducing the problem when compiling. I figured that making use of TRRICCI and UPPERMET in different files does not yield any problems. So for now I split up my routines to avoid this double declaration.
Hi Jens
The problem is that the includes use a macro to avoid problems for double-inclusion: if included a second time, it will be a no-op. This is in general a good idea (e.g., it prevents problems if you include RICCI and TRRICI, which also includes RICCI). However, this is a problem if you include the "declare" part not globally once, but locally (within a function) twice, since the second time the include will be a no-op, an nothing will be declared locally. It also explains why it works if you split things up into different files, as then you only include the _declare includes once in each file.
To prevent this without changing the ADMMacros thorn (which I don't know it would break), put a
#undef TRRICCI_DECLARE
before every include of TRRICCI_declare.h (and likely also other _declare.h files). (You technically do not need it before the first, but it also shouldn't hurt.)
Frank
On Tue, Jul 11, 2017 at 07:45:26AM -0500, Frank Loeffler wrote:
To prevent this without changing the ADMMacros thorn (which I don't know it would break), put a
#undef TRRICCI_DECLARE
... Having said that, the possibly cleanest way to use this old(!) thorn is to do what you already did: try to separate things into multiple files.
Frank
users@lists.einsteintoolkit.org