From: Francis Russell Date: Thu, 7 Jun 2012 18:46:51 +0000 (+0100) Subject: Update ONETEP symbols to reference correct modules. X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=6fdfa481c733020f293bfc5f14ae7039af073b52;p=francis%2Fofc.git Update ONETEP symbols to reference correct modules. --- diff --git a/src/ofc/generators/onetep/OnetepFunctions.scala b/src/ofc/generators/onetep/OnetepFunctions.scala index 8ab1325..dd5424e 100644 --- a/src/ofc/generators/onetep/OnetepFunctions.scala +++ b/src/ofc/generators/onetep/OnetepFunctions.scala @@ -38,6 +38,8 @@ object OnetepFunctions { List(fourier_apply_box_pair).map(_.addProperty(new FortranModule("fourier"))) + // module sparse + val sparse_first_elem_on_node = new FortranFunctionSignature[IntType]("sparse_first_elem_on_node", Seq(("node", new IntType), ("mat", OnetepTypes.SPAM3), @@ -65,5 +67,5 @@ object OnetepFunctions { sparse_index_length, sparse_generate_index, sparse_atom_of_elem, - sparse_put_element_real).map(_.addProperty(new FortranModule("fourier"))) + sparse_put_element_real).map(_.addProperty(new FortranModule("sparse"))) } diff --git a/src/ofc/generators/onetep/OnetepTypes.scala b/src/ofc/generators/onetep/OnetepTypes.scala index b0a3528..75ff483 100644 --- a/src/ofc/generators/onetep/OnetepTypes.scala +++ b/src/ofc/generators/onetep/OnetepTypes.scala @@ -3,6 +3,9 @@ import ofc.codegen._ object OnetepTypes { object FunctionBasis extends StructType { + addProperty(new FortranModule("function_basis")) + def getName = "FUNC_BASIS" + val numPPDsInSphere = { val fieldType = new PointerType[ArrayType[IntType]](new ArrayType[IntType](1)) new FieldSymbol[PointerType[ArrayType[IntType]]]("n_ppds_sphere", fieldType) @@ -19,54 +22,68 @@ object OnetepTypes { val fieldType = new PointerType[ArrayType[StructType]](new ArrayType[StructType](1, Sphere)) new FieldSymbol[PointerType[ArrayType[StructType]]]("spheres", fieldType) } - - def getName = "FUNC_BASIS" } object Sphere extends StructType { + addProperty(new FortranModule("basis")) + def getName = "SPHERE" + val ppdList = { val fieldType = new PointerType[ArrayType[IntType]](new ArrayType[IntType](2)) new FieldSymbol[PointerType[ArrayType[IntType]]]("ppd_list", fieldType) } val offset = new FieldSymbol[IntType]("offset") - def getName = "SPHERE" } object Point extends StructType { + addProperty(new FortranModule("geometry")) + def getName = "POINT" + val x = new FieldSymbol[FloatType]("X") val y = new FieldSymbol[FloatType]("Y") val z = new FieldSymbol[FloatType]("Z") val coord = List(x,y,z) - def getName = "POINT" } object CellInfo extends StructType { + private val module = new FortranModule("simulation_cell") + addProperty(module) + def getName = "CELL_INFO" + val public = new NamedUnboundVarSymbol[StructType]("pub_cell", OnetepTypes.CellInfo) + public.addProperty(module) + val ppdWidth = {for (dim <- 1 to 3) yield new FieldSymbol[IntType]("n_pt"+dim)}.toSeq val numPPDs = {for (dim <- 1 to 3) yield new FieldSymbol[IntType]("n_ppds_a"+dim)}.toSeq val pointsInPPD = new FieldSymbol[IntType]("n_pts") val latticeReciprocal = for(dim <- 1 to 3) yield new FieldSymbol[StructType]("b"+dim, Point) val weight = new FieldSymbol[FloatType]("weight") - def getName = "CELL_INFO" } object TightBox extends StructType { + addProperty(new FortranModule("basis")) + def getName = "FUNCTION_TIGHT_BOX" + val startPts = {for (dim <- 1 to 3) yield new FieldSymbol[IntType]("start_pts"+dim)}.toSeq val finishPts = {for (dim <- 1 to 3) yield new FieldSymbol[IntType]("finish_pts"+dim)}.toSeq val startPPD = {for (dim <- 1 to 3) yield new FieldSymbol[IntType]("start_ppds"+dim)}.toSeq val finishPPD = {for (dim <- 1 to 3) yield new FieldSymbol[IntType]("finish_ppds"+dim)}.toSeq - def getName = "FUNCTION_TIGHT_BOX" } object FFTBoxInfo extends StructType { + addProperty(new FortranModule("fourier")) + def getName = "FFTBOX_INFO" + val public = new NamedUnboundVarSymbol[StructType]("pub_fftbox", FFTBoxInfo) + public.addProperty(new FortranModule("simulation_cell")) + val latticeReciprocal = for(dim <- 1 to 3) yield new FieldSymbol[StructType]("b"+dim, Point) val totalPts = {for (dim <- 1 to 3) yield new FieldSymbol[IntType]("total_pt"+dim)}.toSeq - def getName = "FFTBOX_INFO" } object SPAM3 extends StructType { + addProperty(new FortranModule("sparse")) def getName = "SPAM3" } } diff --git a/src/ofc/generators/onetep/OnetepVariables.scala b/src/ofc/generators/onetep/OnetepVariables.scala index 6d7648d..277ad7b 100644 --- a/src/ofc/generators/onetep/OnetepVariables.scala +++ b/src/ofc/generators/onetep/OnetepVariables.scala @@ -2,12 +2,14 @@ package ofc.generators.onetep import ofc.codegen._ object OnetepVariables { - // parallel_strategy + // comms val pub_my_node_id = new NamedUnboundVarSymbol[IntType]("pub_my_node_id") + pub_my_node_id.addProperty(new FortranModule("comms")) + + // parallel_strategy val pub_first_atom_on_node = new NamedUnboundVarSymbol[ArrayType[IntType]]("pub_first_atom_on_node", new ArrayType[IntType](1)) val pub_num_atoms_on_node = new NamedUnboundVarSymbol[ArrayType[IntType]]("pub_num_atoms_on_node", new ArrayType[IntType](1)) - List(pub_my_node_id, - pub_first_atom_on_node, + List(pub_first_atom_on_node, pub_num_atoms_on_node).map(_.addProperty(new FortranModule("parallel_strategy"))) }