Randy Paredis hace 4 años
padre
commit
1a559f707d

+ 7 - 0
doc/CBD.converters.CBD2C.rst

@@ -0,0 +1,7 @@
+Generate C code from CBDs
+=========================
+
+.. automodule:: CBD.converters.CBD2C
+    :members:
+    :undoc-members:
+    :show-inheritance:

+ 1 - 0
doc/CBD.converters.rst

@@ -13,6 +13,7 @@ Submodules
 
    CBD.converters.eq2CBD
    CBD.converters.latexify
+   CBD.converters.CBD2C
    CBD.converters.CBDDraw
    CBD.converters.hybrid
 

+ 2 - 0
doc/install.rst

@@ -31,6 +31,8 @@ Next, there are some additional **optional** requirements:
     allow the creation of CBDs directly from a textual language.
   * `PythonPDEVS <http://msdl.cs.mcgill.ca/projects/DEVS/PythonPDEVS>`_ for the :mod:`CBD.converters.hybrid`
     module. This allows CBDs to be run inside of DEVS simulations.
+  * `Jinja2 <https://jinja.palletsprojects.com/en/3.0.x/>`_ for the :mod:`CBD.converters.CBD2C` module, allowing
+    conversion to C code.
 
 * **Documentation:**
 

+ 8 - 16
src/CBD/converters/CBD2C/__init__.py

@@ -1,20 +1,16 @@
 """
 A module that allows the creation of a C file, in which the block's computations are inlined.
 Additional library files will be created to allow for linking:
-	- lsolve.c
-	- lsolve.h
 
-The :code:`template.c` file is the jinja template file.
+- lsolve.c
+- lsolve.h
 
-Note:
-	To compile the generated code, execute
 
-	```
-		gcc <filename>.c lsolve.c -lm
-	```
+Requires `Jinja2 <https://jinja.palletsprojects.com/en/3.0.x/>`_.
+The :code:`template.c` file is the jinja template file.
 
-Requires:
-	- `Jinja2 <https://jinja.palletsprojects.com/en/3.0.x/>`_
+Note:
+	To compile the generated code, execute :code:`gcc <filename>.c lsolve.c -lm`.
 """
 from CBD.scheduling import TopologicalScheduler
 from CBD.solver import GaussianJordanLinearSolver
@@ -35,7 +31,7 @@ class CBD2C:
 	:code:`itcnt * delta`.
 
 	Note:
-		This class does *not* change the original model.
+		This class does **not** change the original model.
 
 	Warning:
 		This class only works if the dependency graph is fixed
@@ -168,11 +164,7 @@ class CBD2C:
 		Generates the C file and copies the sources for the
 		lsolve library in the same folder.
 
-		To compile the generated code, execute
-
-		```
-			gcc <filename>.c lsolve.c -lm
-		```
+		To compile the generated code, execute :code:`gcc <filename>.c lsolve.c -lm`.
 
 		Args:
 			fname (str):    The filename of the C-code.

+ 0 - 1
src/CBD/lib/std.py

@@ -88,7 +88,6 @@ class AdderBlock(BaseBlock):
 		"""
 		return self.__numberOfInputs
 
-from functools import reduce
 class ProductBlock(BaseBlock):
 	"""
 	The product block will multiply all the inputs

+ 2 - 2
src/CBD/solver.py

@@ -54,9 +54,9 @@ class Solver:
 		raise NotImplementedError()
 
 
-class GaussianJordanLinearSolver(Solver):
+class LinearSolver(Solver):
 	"""
-	Solves linear algebraic loops via Gaussian-Jordan Elimination.
+	Solves linear algebraic loops using matrices.
 	"""
 	def checkValidity(self, path, component):
 		if not self.__isLinear(component):