]> git.unchartedbackwaters.co.uk Git - francis/ofc.git/commitdiff
Revise Fortran binding aspect of proposed DSL syntax.
authorFrancis Russell <francis@unchartedbackwaters.co.uk>
Fri, 7 Sep 2012 17:52:41 +0000 (18:52 +0100)
committerFrancis Russell <francis@unchartedbackwaters.co.uk>
Fri, 7 Sep 2012 17:52:41 +0000 (18:52 +0100)
examples/density_on_dbl_grid.ofl
examples/integrals_grad.ofl
examples/integrals_kinetic.ofl
examples/integrals_locpot.ofl
examples/integrals_pos.ofl

index 7904cea2d15488d617c40eebba232b34f32c959e..a1f812e576ce1ccaf358f63f429617f80e026aa8 100644 (file)
@@ -11,11 +11,11 @@ density_dbl[spin] = sum(bra[alpha]*sum(denskern[spin, alpha, beta] * ngwfs[beta]
 
 # Implementation specific
 target ONETEP
-Variable density_dbl    is fortran_param with name("density_dbl"), type("double(:,:,:,:)"), shape(cell_double_grid*spin)
-Variable denskern       is fortran_param with name("denskern"), type("spam3(:)"), shape(direction*matrix)
-Variable overlap        is fortran_param with name("overlap"), type("spam3")
-Parameter ngwf_basis    is fortran_param with name("ngwf_basis"), type("func_basis")
-Parameter ngwfs_on_grid is fortran_param with name("ngwfs_on_grid"), type("double(:)")
-Variable ngwfs          is ppd_function_set with data(ngwfs_on_grid), basis(ngwf_basis)
-OutputFunction _        is fortran_function with name("density_on_dbl_grid"), 
+Variable density_dbl    = fortran_param with name("density_dbl"), type(double(a,b,c,d)), space(psinc_fine_grid(a,b,c)), indexed(spin(d))
+Variable denskern       = fortran_param with name("denskern"), type(spam3(a)), indexed(direction(a) * row * col)
+Variable overlap        = fortran_param with name("overlap"), type(spam3)
+Parameter ngwf_basis    = fortran_param with name("ngwf_basis"), type(func_basis)
+Parameter ngwfs_on_grid = fortran_param with name("ngwfs_on_grid"), type(double(:))
+Variable ngwfs          = ppd_function_set with data(ngwfs_on_grid), basis(ngwf_basis)
+OutputFunction output   = fortran_function with name("density_on_dbl_grid"),
                                                  params(density_dbl, denskern, overlap, ngwfs_on_grid, ngwf_basis)
index 3112da120f9746b58b77c435b2fef71d72f57164..147c40f58875e30f6ced6335acbfd6518c582e8c 100644 (file)
@@ -1,6 +1,6 @@
 # Parameter information
-Array[SpatialIndex, FunctionIndex, FunctionIndex] kinet
-FunctionSet bra, ket
+Scalar[SpatialIndex, FunctionIndex, FunctionIndex] kinet
+Function[FunctionIndex] bra, ket
 FunctionIndex alpha, beta
 SpatialIndex i
 
@@ -9,11 +9,12 @@ kinet[i, alpha, beta] = inner(bra[alpha], derivative(ket[beta], i))
 
 # Implementation specific
 target ONETEP
-Variable kinet        = FortranVariable("kinet", "spam3(:)")
-Variable bra_basis    = FortranVariable("bra_basis", "func_basis")
-Variable bras_on_grid = FortranVariable("bras_on_grid", "double(:)")
-Variable ket_basis    = FortranVariable("ket_basis", "func_basis")
-Variable kets_on_grid = FortranVariable("kets_on_grid", "double(:)")
-Variable bra          = PPDFunctionSet(bras_on_grid, "bra_basis")
-Variable ket          = PPDFunctionSet(kets_on_grid, "ket_basis")
-Variable output       = FortranFunction("integrals_grad", kinet, bras_on_grid, bra_basis, kets_on_grid, ket_basis)
+Variable kinet         = fortran_param with name("kinet"), type(spam3(a)), indexed(direction(a) * row * col)
+Parameter bra_basis    = fortran_param with name("bra_basis"), type(func_basis)
+Parameter bras_on_grid = fortran_param with name("bras_on_grid"), type(double(:))
+Parameter ket_basis    = fortran_param with name("ket_basis") , type(func_basis)
+Parameter kets_on_grid = fortran_param with name("kets_on_grid"), type(double(:))
+Variable bra           = ppd_function_set with data(bras_on_grid), basis(bra_basis)
+Variable ket           = ppd_function_set with data(kets_on_grid), basis(ket_basis)
+OutputFunction output  = fortran_function with name("integrals_grad"),
+                                              params(kinet, bras_on_grid, bra_basis, kets_on_grid, ket_basis)
index eb14a8cffe4fd23edf7eff56b4dce25550971bb5..787ec9812b75e4224ccef96b84c7941787a45c8f 100644 (file)
@@ -1,6 +1,6 @@
 # Parameter information
-Array[FunctionIndex, FunctionIndex] kinet
-FunctionSet bra, ket
+Scalar[FunctionIndex, FunctionIndex] kinet
+Function[FunctionIndex] bra, ket
 FunctionIndex alpha, beta
 
 # Computation
@@ -8,11 +8,12 @@ kinet[alpha, beta] = inner(bra[alpha], laplacian(ket[beta])*-0.5)
 
 # Implementation specific
 target ONETEP
-Variable kinet        = FortranVariable("kinet", "spam3")
-Variable bra_basis    = FortranVariable("bra_basis", "func_basis")
-Variable bras_on_grid = FortranVariable("bras_on_grid", "double(:)")
-Variable ket_basis    = FortranVariable("ket_basis", "func_basis")
-Variable kets_on_grid = FortranVariable("kets_on_grid", "double(:)")
-Variable bra          = PPDFunctionSet(bras_on_grid, bra_basis)
-Variable ket          = PPDFunctionSet(kets_on_grid, ket_basis)
-Variable output       = FortranFunction("integrals_kinetic", kinet, bras_on_grid, bra_basis, kets_on_grid, ket_basis)
+Variable kinet         = fortran_param with name("kinet"), type(spam3)
+Parameter bra_basis    = fortran_param with name("bra_basis"), type(func_basis)
+Parameter bras_on_grid = fortran_param with name("bras_on_grid"), type(double(:))
+Parameter ket_basis    = fortran_param with name("ket_basis"), type(func_basis)
+Parameter kets_on_grid = fortran_param with name("kets_on_grid"), type(double(:))
+Variable bra           = ppd_function_set with data(bras_on_grid), basis(bra_basis)
+Variable ket           = ppd_function_set with data(kets_on_grid), bais(ket_basis)
+OutputFunction output  = fortran_function with name("integrals_kinetic"),
+                                              params(kinet, bras_on_grid, bra_basis, kets_on_grid, ket_basis)
index e128eae353f05802f2669dcf5e6dd9ca7bfa1077..77962ce042f8384696d6ec5b845f3b4ec5ecd2ea 100644 (file)
@@ -1,7 +1,7 @@
 # Parameter information
-Array[FunctionIndex, FunctionIndex] locpot
+Scalar[FunctionIndex, FunctionIndex] locpot
 Function potential_fine
-FunctionSet bra, ket
+Function[FunctionIndex] bra, ket
 FunctionIndex alpha, beta
 
 # Computation
@@ -9,13 +9,13 @@ locpot[alpha, beta] = inner(bra[alpha], potential_fine*ket[beta])
 
 # Implementation specific
 target ONETEP
-Variable locpot         = FortranVariable("locpot", "spam3")
-Variable bra_basis      = FortranVariable("bra_basis", "func_basis")
-Variable bras_on_grid   = FortranVariable("bras_on_grid", "double(:)")
-Variable ket_basis      = FortranVariable("ket_basis", "func_basis")
-Variable kets_on_grid   = FortranVariable("kets_on_grid", "double(:)")
-Variable potential_fine = PsincCoarseFunction(FortranVariable("potential_fine", "double(:,:,:)"))
-Variable bra            = PPDFunctionSet(bras_on_grid, bra_basis)
-Variable ket            = PPDFunctionSet(kets_on_grid, ket_basis)
-Variable output         = FortranFunction("integrals_locpot", locpot, bras_on_grid, bra_basis, 
-                                          kets_on_grid, ket_basis, potential_fine)
+Variable locpot         = fortran_param with name("locpot"), type(spam3)
+Parameter bra_basis     = fortran_param with name("bra_basis"), type(func_basis)
+Parameter bras_on_grid  = fortran_param with name("bras_on_grid"), type(double(:))
+Parameter ket_basis     = fortran_param with name("ket_basis"), type(func_basis)
+Parameter kets_on_grid  = fortran_param with name("kets_on_grid"), type(double(:))
+Variable potential_fine = fortran_param with name("potential_fine"), type(double(a,b,c)), space(psinc_fine_grid(a,b,c))
+Variable bra            = ppd_function_set with data(bras_on_grid), basis(bra_basis)
+Variable ket            = ppd_function_set with data(kets_on_grid), basis(ket_basis)
+OutputFunction output   = fortran_function with name("integrals_locpot"),
+                                                params(locpot, bras_on_grid, bra_basis, kets_on_grid, ket_basis, potential_fine)
index 5b7bb570808ef322cef352925541a6a79d834ecc..68e089b43616d9f93ada2c65b0f9967a787e73a0 100644 (file)
@@ -1,6 +1,6 @@
 # Parameter information
-Array[SpatialIndex, FunctionIndex, FunctionIndex] rmat
-FunctionSet bra, ket
+Scalar[SpatialIndex, FunctionIndex, FunctionIndex] rmat
+Function[FunctionIndex] bra, ket
 FunctionIndex alpha, beta
 Scalar order
 SpatialIndex i
@@ -10,12 +10,13 @@ rmat[i, alpha, beta] = inner(bra[alpha], ket[beta] * pos[i]^order)
 
 # Implementation specific
 target ONETEP
-Variable rmat        = FortranVariable("rmat", "spam3(:)")
-Variable bra_basis    = FortranVariable("bra_basis", "func_basis")
-Variable bras_on_grid = FortranVariable("bras_on_grid", "double(:)")
-Variable order        = FortranVariable("order", "integer")
-Variable ket_basis    = FortranVariable("ket_basis", "func_basis")
-Variable kets_on_grid = FortranVariable("kets_on_grid", "double(:)")
-Variable bra          = PPDFunctionSet(bras_on_grid, "bra_basis")
-Variable ket          = PPDFunctionSet(kets_on_grid, "ket_basis")
-Variable output       = FortranFunction("integrals_pos", rmat, bras_on_grid, bra_basis, kets_on_grid, ket_basis, order)
+Variable rmat          = fortran_param with name("rmat"), type(spam3(a)), indexed(direction(a) * row * col)
+Parameter bra_basis    = fortran_param with name("bra_basis"), type(func_basis)
+Parameter bras_on_grid = fortran_param with name("bras_on_grid"), type(double(:))
+Variable order         = fortran_param with name("order", type(integer)
+Parameter ket_basis    = fortran_param with name("ket_basis"), type(func_basis)
+Parameter kets_on_grid = fortran_param with name("kets_on_grid"), type(double(:))
+Variable bra           = ppd_function_set with data(bras_on_grid), basis(bra_basis)
+Variable ket           = ppd_function_set with data(kets_on_grid), basis(ket_basis)
+OutputFunction output  = fortran_function with name("integrals_pos"),
+                                               params(rmat, bras_on_grid, bra_basis, kets_on_grid, ket_basis, order)