Skip to content

Commit

Permalink
Z4cow: make code compile
Browse files Browse the repository at this point in the history
  • Loading branch information
lwJi committed Sep 11, 2024
1 parent faaf83b commit 0859670
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 15 deletions.
5 changes: 5 additions & 0 deletions Z4cow/src/adm.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ using namespace Arith;
using namespace Loop;
using namespace std;

template <typename T>
CCTK_DEVICE CCTK_HOST CCTK_ATTRIBUTE_ALWAYS_INLINE inline T Power(T x, int y) {
return (y == 2) ? Arith::pow2(x) : Arith::pown(x, y);
}

extern "C" void Z4cow_ADM(CCTK_ARGUMENTS) {
DECLARE_CCTK_ARGUMENTS_Z4cow_ADM;
DECLARE_CCTK_PARAMETERS;
Expand Down
2 changes: 1 addition & 1 deletion Z4cow/src/enforce.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ extern "C" void Z4cow_Enforce(CCTK_ARGUMENTS) {
// Enforce algebraic constraints
// See arXiv:1212.2901 [gr-qc].
const vreal detgammat_old = calc_det(gammat_old);
const vreal W1_old = pow(detgammat_old, -1.0 / 6.0);
const vreal W1_old = pown(detgammat_old, -1.0 / 6.0);
const smat<vreal, 3> gammat([&](int a, int b) ARITH_INLINE {
return W1_old * W1_old * gammat_old(a, b);
});
Expand Down
2 changes: 1 addition & 1 deletion Z4cow/src/initial1.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ extern "C" void Z4cow_Initial1(CCTK_ARGUMENTS) {
const vreal detg = calc_det(g);
const smat<vreal, 3> gu = calc_inv(g, detg);

const vreal W = pow(detg, -1.0 / 6.0);
const vreal W = pown(detg, -1.0 / 6.0);
const smat<vreal, 3> gammat(
[&](int a, int b) ARITH_INLINE { return W * W * g(a, b); });
const vreal trK = sum_symm<3>(
Expand Down
24 changes: 12 additions & 12 deletions Z4cow/wolfram/Z4cow_set_constraint.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -213,34 +213,34 @@ vreal invgamt33
-Power(gamt12,2) + gamt11*gamt22
;

vreal gam11
vreal invgam11
=
gamt11/Power(W,2)
invgamt11*Power(W,2)
;

vreal gam12
vreal invgam12
=
gamt12/Power(W,2)
invgamt12*Power(W,2)
;

vreal gam13
vreal invgam13
=
gamt13/Power(W,2)
invgamt13*Power(W,2)
;

vreal gam22
vreal invgam22
=
gamt22/Power(W,2)
invgamt22*Power(W,2)
;

vreal gam23
vreal invgam23
=
gamt23/Power(W,2)
invgamt23*Power(W,2)
;

vreal gam33
vreal invgam33
=
gamt33/Power(W,2)
invgamt33*Power(W,2)
;

vreal GtDDD111
Expand Down
2 changes: 1 addition & 1 deletion Z4cow/wolfram/Z4cow_set_constraint.wl
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ $MainPrint[] :=
PrintInitializations[{Mode -> "MainIn", StorageType -> "Tile", TensorType -> "Smat"},
Drop[ddEvolVarlist, -2]];
pr[];
PrintEquations[{Mode -> "Temp"}, Drop[Drop[IntermediateVarlist, {3}], {-4,-2}]];
PrintEquations[{Mode -> "Temp"}, Drop[Drop[IntermediateVarlist, {4}], {-4,-2}]];
PrintEquations[{Mode -> "Temp"}, Drop[DDVarlist, -1]];
PrintEquations[{Mode -> "Temp"}, RVarlist];
PrintEquations[{Mode -> "Temp"}, Drop[MatterVarlist, -2]];
Expand Down

0 comments on commit 0859670

Please sign in to comment.