From fedd4f586c987eb9ebcfa824c3233e50b3dfad29 Mon Sep 17 00:00:00 2001 From: Jean-Matthieu Etancelin <jean-matthieu.etancelin@imag.fr> Date: Thu, 5 Jul 2012 15:29:02 +0000 Subject: [PATCH] Clean field and domain. Fixing operator (begin). Fix doxyfile. --- HySoP/DoxyConf/parmes.doxyfile | 278 ++++++++++++------ HySoP/hysop/domain/box.py | 17 +- HySoP/hysop/domain/discrete.py | 6 +- HySoP/hysop/domain/domain.py | 11 +- HySoP/hysop/domain/grid.py | 10 +- HySoP/hysop/fields/analytical.py | 21 +- HySoP/hysop/fields/continuous.py | 17 +- HySoP/hysop/fields/discrete.py | 74 +++-- HySoP/hysop/fields/topology.py | 245 ++++++++------- HySoP/hysop/operator/Advection.py | 15 +- HySoP/hysop/operator/__init__.py | 14 +- .../{AdvectionDOp.py => advection_d.py} | 9 +- .../{ContinuousOperator.py => continuous.py} | 24 +- .../{DiscreteOperator.py => discrete.py} | 26 +- 14 files changed, 431 insertions(+), 336 deletions(-) rename HySoP/hysop/operator/{AdvectionDOp.py => advection_d.py} (97%) rename HySoP/hysop/operator/{ContinuousOperator.py => continuous.py} (59%) rename HySoP/hysop/operator/{DiscreteOperator.py => discrete.py} (70%) diff --git a/HySoP/DoxyConf/parmes.doxyfile b/HySoP/DoxyConf/parmes.doxyfile index 2220187f9..10e86296c 100644 --- a/HySoP/DoxyConf/parmes.doxyfile +++ b/HySoP/DoxyConf/parmes.doxyfile @@ -1,4 +1,4 @@ -# Doxyfile 1.7.3 +# Doxyfile 1.8.1.1 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project @@ -22,8 +22,9 @@ DOXYFILE_ENCODING = UTF-8 -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded -# by quotes) that should identify the project. +# The PROJECT_NAME tag is a single word (or sequence of words) that should +# identify the project. Note that if you do not use Doxywizard you need +# to put quotes around the project name if it contains spaces. PROJECT_NAME = ParMePy @@ -33,8 +34,8 @@ PROJECT_NAME = ParMePy PROJECT_NUMBER = 1.0.0 -# Using the PROJECT_BRIEF tag one can provide an optional one line description -# for a project that appears at the top of each page and should give viewer +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer # a quick idea about the purpose of the project. Keep the description short. PROJECT_BRIEF = "Particular Methods simulation on hybrid architectures" @@ -194,6 +195,13 @@ TAB_SIZE = 8 ALIASES = +# This tag can be used to specify a number of word-keyword mappings (TCL only). +# A mapping has the form "name=value". For example adding +# "class=itcl::class" will allow you to use the command class in the +# itcl::class meaning. + +TCL_SUBST = + # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C # sources only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list @@ -232,6 +240,15 @@ OPTIMIZE_OUTPUT_VHDL = NO EXTENSION_MAPPING = +# If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all +# comments according to the Markdown format, which allows for more readable +# documentation. See http://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you +# can mix doxygen, HTML, and XML commands with Markdown formatting. +# Disable only in case of backward compatibilities issues. + +MARKDOWN_SUPPORT = YES + # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should # set this tag to YES in order to let doxygen match functions declarations and @@ -276,6 +293,22 @@ DISTRIBUTE_GROUP_DOC = NO SUBGROUPING = YES +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and +# unions are shown inside the group in which they are included (e.g. using +# @ingroup) instead of on a separate page (for HTML and Man pages) or +# section (for LaTeX and RTF). + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and +# unions with only public data fields will be shown inline in the documentation +# of the scope in which they are defined (i.e. file, namespace, or group +# documentation), provided this scope is documented. If set to NO (the default), +# structs, classes, and unions are shown on a separate page (for HTML and Man +# pages) or section (for LaTeX and RTF). + +INLINE_SIMPLE_STRUCTS = NO + # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum # is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct @@ -298,10 +331,21 @@ TYPEDEF_HIDES_STRUCT = NO # a logarithmic scale so increasing the size by one will roughly double the # memory usage. The cache size is given by this formula: # 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, -# corresponding to a cache size of 2^16 = 65536 symbols +# corresponding to a cache size of 2^16 = 65536 symbols. SYMBOL_CACHE_SIZE = 0 +# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be +# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given +# their name and scope. Since this can be an expensive process and often the +# same symbol appear multiple times in the code, doxygen keeps a cache of +# pre-resolved symbols. If the cache is too small doxygen will become slower. +# If the cache is too large, memory is wasted. The cache size is given by this +# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols. + +LOOKUP_CACHE_SIZE = 0 + #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- @@ -318,6 +362,11 @@ EXTRACT_ALL = YES EXTRACT_PRIVATE = YES +# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal +# scope will be included in the documentation. + +EXTRACT_PACKAGE = NO + # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. @@ -451,10 +500,10 @@ SORT_GROUP_NAMES = NO SORT_BY_SCOPE_NAME = YES -# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to # do proper type resolution of all parameters of a function it will reject a -# match between the prototype and the implementation of a member function even -# if there is only one candidate or it is obvious which candidate to choose +# match between the prototype and the implementation of a member function even +# if there is only one candidate or it is obvious which candidate to choose # by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen # will still accept a match between prototype and implementation in such cases. @@ -505,12 +554,6 @@ MAX_INITIALIZER_LINES = 39 SHOW_USED_FILES = YES -# If the sources in your project are distributed over multiple directories -# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy -# in the documentation. The default is NO. - -SHOW_DIRECTORIES = YES - # Set the SHOW_FILES tag to NO to disable the generation of the Files page. # This will remove the Files entry from the Quick Index and from the # Folder Tree View (if specified). The default is YES. @@ -535,13 +578,23 @@ FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed # by doxygen. The layout file controls the global structure of the generated -# output files in an output format independent way. The create the layout file +# output files in an output format independent way. To create the layout file # that represents doxygen's defaults, run doxygen with the -l option. # You can optionally specify a file name after the option, if omitted # DoxygenLayout.xml will be used as the name of the layout file. LAYOUT_FILE = +# The CITE_BIB_FILES tag can be used to specify one or more bib files +# containing the references data. This must be a list of .bib files. The +# .bib extension is automatically appended if omitted. Using this command +# requires the bibtex tool to be installed. See also +# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style +# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this +# feature you need bibtex and perl available in the search path. + +CITE_BIB_FILES = + #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- @@ -603,8 +656,9 @@ WARN_LOGFILE = # with spaces. INPUT = ../src/main \ - . \ - ../src + ../src \ + ../parmepy \ + ./ # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is @@ -630,15 +684,17 @@ FILE_PATTERNS = *.doxygen \ # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. -RECURSIVE = NO +RECURSIVE = YES -# The EXCLUDE tag can be used to specify files and/or directories that should +# The EXCLUDE tag can be used to specify files and/or directories that should be # excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# Note that relative paths are relative to the directory from which doxygen is +# run. EXCLUDE = -# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded # from the input. @@ -703,7 +759,7 @@ INPUT_FILTER = # info on how filters are used. If FILTER_PATTERNS is empty or if # non of the patterns match the file name, INPUT_FILTER is applied. -FILTER_PATTERNS = *.py=/Library/Frameworks/EPD64.framework/Versions/7.1/bin/doxypy.py +FILTER_PATTERNS = *.py=/usr/local/bin/doxypy.py # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source @@ -737,7 +793,7 @@ INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code -# fragments. Normal C and C++ comments will always remain visible. +# fragments. Normal C, C++ and Fortran comments will always remain visible. STRIP_CODE_COMMENTS = YES @@ -820,7 +876,14 @@ HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a -# standard header. +# standard header. Note that when using a custom header you are responsible +# for the proper inclusion of any scripts and style sheets that doxygen +# needs, which is dependent on the configuration options used. +# It is advised to generate a default header using "doxygen -w html +# header.html footer.html stylesheet.css YourConfigFile" and then modify +# that header. Note that the header is subject to change so you typically +# have to redo this when upgrading to a newer version of doxygen or when +# changing the value of configuration settings such as GENERATE_TREEVIEW! HTML_HEADER = @@ -835,12 +898,21 @@ HTML_FOOTER = # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet. Note that doxygen will try to copy # the style sheet file to the HTML output directory, so don't put your own -# stylesheet in the HTML output directory as well, or it will be erased! +# style sheet in the HTML output directory as well, or it will be erased! HTML_STYLESHEET = +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that +# the files will be copied as-is; there are no commands or markers available. + +HTML_EXTRA_FILES = + # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. -# Doxygen will adjust the colors in the stylesheet and background images +# Doxygen will adjust the colors in the style sheet and background images # according to this color. Hue is specified as an angle on a colorwheel, # see http://en.wikipedia.org/wiki/Hue for more information. # For instance the value 0 represents red, 60 is yellow, 120 is green, @@ -870,20 +942,23 @@ HTML_COLORSTYLE_GAMMA = 124 HTML_TIMESTAMP = YES -# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, -# files or namespaces will be aligned in HTML using tables. If set to -# NO a bullet list will be used. - -HTML_ALIGN_MEMBERS = YES - # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the -# page has loaded. For this to work a browser that supports -# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox -# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). +# page has loaded. HTML_DYNAMIC_SECTIONS = NO +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of +# entries shown in the various tree structured indices initially; the user +# can expand and collapse entries dynamically later on. Doxygen will expand +# the tree to such a level that at most the specified number of entries are +# visible (unless a fully collapsed tree already exceeds this amount). +# So setting the number of entries 1 will produce a full collapsed tree by +# default. 0 is a special value representing an infinite number of entries +# and will result in a full expanded tree by default. + +HTML_INDEX_NUM_ENTRIES = 100 + # If the GENERATE_DOCSET tag is set to YES, additional index files # will be generated that can be used as input for Apple's Xcode 3 # integrated development environment, introduced with OSX 10.5 (Leopard). @@ -1035,33 +1110,32 @@ GENERATE_ECLIPSEHELP = NO ECLIPSE_DOC_ID = org.doxygen.Project -# The DISABLE_INDEX tag can be used to turn on/off the condensed index at -# top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. +# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) +# at top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. Since the tabs have the same information as the +# navigation tree you can set this option to NO if you already set +# GENERATE_TREEVIEW to YES. DISABLE_INDEX = NO -# This tag can be used to set the number of enum values (range [0,1..20]) -# that doxygen will group on one line in the generated HTML documentation. -# Note that a value of 0 will completely suppress the enum values from -# appearing in the overview section. - -ENUM_VALUES_PER_LINE = 4 - # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. # If the tag value is set to YES, a side panel will be generated # containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). -# Windows users are probably better off using the HTML help feature. +# Windows users are probably better off using the HTML help feature. +# Since the tree basically has the same information as the tab index you +# could consider to set DISABLE_INDEX to NO when enabling this option. GENERATE_TREEVIEW = NO -# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, -# and Class Hierarchy pages using a tree view instead of an ordered list. +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values +# (range [0,1..20]) that doxygen will group on one line in the generated HTML +# documentation. Note that a value of 0 will completely suppress the enum +# values from appearing in the overview section. -USE_INLINE_TREES = NO +ENUM_VALUES_PER_LINE = 4 # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree @@ -1094,7 +1168,7 @@ FORMULA_TRANSPARENT = YES # (see http://www.mathjax.org) which uses client side Javascript for the # rendering instead of using prerendered bitmaps. Use this if you do not # have LaTeX installed or if you want to formulas look prettier in the HTML -# output. When enabled you also need to install MathJax separately and +# output. When enabled you may also need to install MathJax separately and # configure the path to it using the MATHJAX_RELPATH option. USE_MATHJAX = YES @@ -1103,13 +1177,18 @@ USE_MATHJAX = YES # HTML output directory using the MATHJAX_RELPATH option. The destination # directory should contain the MathJax.js script. For instance, if the mathjax # directory is located at the same level as the HTML output directory, then -# MATHJAX_RELPATH should be ../mathjax. The default value points to the -# mathjax.org site, so you can quickly see the result without installing -# MathJax, but it is strongly recommended to install a local copy of MathJax -# before deployment. +# MATHJAX_RELPATH should be ../mathjax. The default value points to +# the MathJax Content Delivery Network so you can quickly see the result without +# installing MathJax. However, it is strongly recommended to install a local +# copy of MathJax from http://www.mathjax.org before deployment. MATHJAX_RELPATH = http://www.mathjax.org/mathjax +# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension +# names that should be enabled during MathJax rendering. + +MATHJAX_EXTENSIONS = + # When the SEARCHENGINE tag is enabled doxygen will generate a search box # for the HTML output. The underlying search engine uses javascript # and DHTML and should work on any modern browser. Note that when using @@ -1183,6 +1262,13 @@ EXTRA_PACKAGES = LATEX_HEADER = +# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for +# the generated latex document. The footer should contain everything after +# the last chapter. If it is left blank doxygen will generate a +# standard footer. Notice: only use this tag if you know what you are doing! + +LATEX_FOOTER = + # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references @@ -1216,6 +1302,12 @@ LATEX_HIDE_INDICES = NO LATEX_SOURCE_CODE = NO +# The LATEX_BIB_STYLE tag can be used to specify the style to use for the +# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See +# http://en.wikipedia.org/wiki/BibTeX for more info. + +LATEX_BIB_STYLE = plain + #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- @@ -1247,7 +1339,7 @@ COMPACT_RTF = NO RTF_HYPERLINKS = NO -# Load stylesheet definitions from file. Syntax is similar to doxygen's +# Load style sheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. @@ -1390,7 +1482,7 @@ MACRO_EXPANSION = NO EXPAND_ONLY_PREDEF = NO # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# in the INCLUDE_PATH (see below) will be search if a #include is found. +# pointed to by INCLUDE_PATH will be searched when a #include is found. SEARCH_INCLUDES = YES @@ -1420,7 +1512,7 @@ PREDEFINED = # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. -# Use the PREDEFINED tag if you want to use a different macro definition that +# Use the PREDEFINED tag if you want to use a different macro definition that # overrules the definition found in the source code. EXPAND_AS_DEFINED = @@ -1436,20 +1528,16 @@ SKIP_FUNCTION_MACROS = YES # Configuration::additions related to external references #--------------------------------------------------------------------------- -# The TAGFILES option can be used to specify one or more tagfiles. -# Optionally an initial location of the external documentation -# can be added for each tagfile. The format of a tag file without -# this location is as follows: +# The TAGFILES option can be used to specify one or more tagfiles. For each +# tag file the location of the external documentation should be added. The +# format of a tag file without this location is as follows: # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # TAGFILES = file1=loc1 "file2 = loc2" ... -# where "loc1" and "loc2" can be relative or absolute paths or -# URLs. If a location is present for each tag, the installdox tool -# does not have to be run to correct the links. -# Note that each tag file must have a unique name -# (where the name does NOT include the path) -# If a tag file is not located in the directory in which doxygen -# is run, you must also specify the path to the tagfile here. +# where "loc1" and "loc2" can be relative or absolute paths +# or URLs. Note that each tag file must have a unique name (where the name does +# NOT include the path). If a tag file is not located in the directory in which +# doxygen is run, you must also specify the path to the tagfile here. TAGFILES = @@ -1517,32 +1605,30 @@ HAVE_DOT = YES DOT_NUM_THREADS = 0 -# By default doxygen will write a font called Helvetica to the output -# directory and reference it in all dot files that doxygen generates. -# When you want a differently looking font you can specify the font name -# using DOT_FONTNAME. You need to make sure dot is able to find the font, -# which can be done by putting it in a standard location or by setting the -# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory -# containing the font. +# By default doxygen will use the Helvetica font for all dot files that +# doxygen generates. When you want a differently looking font you can specify +# the font name using DOT_FONTNAME. You need to make sure dot is able to find +# the font, which can be done by putting it in a standard location or by setting +# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the +# directory containing the font. DOT_FONTNAME = Helvetica # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. # The default size is 10pt. -DOT_FONTSIZE = 24 +DOT_FONTSIZE = 11 -# By default doxygen will tell dot to use the output directory to look for the -# FreeSans.ttf font (which doxygen will put there itself). If you specify a -# different font using DOT_FONTNAME you can set the path where dot -# can find it using this tag. +# By default doxygen will tell dot to use the Helvetica font. +# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to +# set the path where dot can find it. DOT_FONTPATH = # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the -# the CLASS_DIAGRAMS tag to NO. +# CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES @@ -1564,6 +1650,15 @@ GROUP_GRAPHS = YES UML_LOOK = YES +# If the UML_LOOK tag is enabled, the fields and methods are shown inside +# the class node. If there are many fields or methods and many nodes the +# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS +# threshold limits the number of items for each type to make the size more +# managable. Set this to 0 for no limit. Note that the threshold may be +# exceeded by 50% before the limit is enforced. + +UML_LIMIT_NUM_FIELDS = 0 + # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. @@ -1604,7 +1699,7 @@ CALLER_GRAPH = YES GRAPHICAL_HIERARCHY = YES -# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES # then doxygen will show the dependencies a directory has on other directories # in a graphical way. The dependency relations are determined by the #include # relations between the files in the directories. @@ -1612,15 +1707,26 @@ GRAPHICAL_HIERARCHY = YES DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. Possible values are png, svg, gif or svg. -# If left blank png will be used. +# generated by dot. Possible values are svg, png, jpg, or gif. +# If left blank png will be used. If you choose svg you need to set +# HTML_FILE_EXTENSION to xhtml in order to make the SVG files +# visible in IE 9+ (other browsers do not have this requirement). DOT_IMAGE_FORMAT = png +# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to +# enable generation of interactive SVG images that allow zooming and panning. +# Note that this requires a modern browser other than Internet Explorer. +# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you +# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files +# visible. Older versions of IE do not have SVG support. + +INTERACTIVE_SVG = NO + # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. -DOT_PATH = /usr/local/bin +DOT_PATH = /opt/local/bin # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the diff --git a/HySoP/hysop/domain/box.py b/HySoP/hysop/domain/box.py index 530801155..6ba485a0d 100644 --- a/HySoP/hysop/domain/box.py +++ b/HySoP/hysop/domain/box.py @@ -4,14 +4,15 @@ from .domain import Domain from .grid import CartesianGrid import numpy as np + class Box(Domain): """ Periodic box representation. - Note FP : BC as parameter may be better? - + Note FP : BC as parameter may be better? + """ - def __init__(self,dimension=3,length=[1.0,1.0,1.0], origin=[0.,0.,0.]): + def __init__(self, dimension=3, length=[1.0, 1.0, 1.0], origin=[0., 0., 0.]): """ Constructor. Create a Box from a dimension, length and minimum position. @@ -33,21 +34,21 @@ class Box(Domain): self.boundaries = np.zeros((self.dimension)) self.boundaries[:] = PERIODIC - def discretize(self,resolution): + def discretize(self, resolution): """Box discretization method. Use an array for discreteDomain??? i.e to associate several discretisations for the same domain. Or maybe this should be a member of the fields?? """ - self.discreteDomain = CartesianGrid(resolution,self) + self.discreteDomain = CartesianGrid(resolution, self) return self.discreteDomain def __str__(self): """ Doc display. """ - s = str(self.dimension)+"D box (parallelepipedic or rectangular) domain : \n" - s += " origin : "+str(self.origin)+", maxPosition :"+str(self.max)+", lengthes :"+str(self.length)+"." + s = str(self.dimension) + "D box (parallelepipedic or rectangular) domain : \n" + s += " origin : " + str(self.origin) + ", maxPosition :" + str(self.max) + ", lengthes :" + str(self.length) + "." return s - + if __name__ == "__main__": print __doc__ print "- Provided class : Box." diff --git a/HySoP/hysop/domain/discrete.py b/HySoP/hysop/domain/discrete.py index 05769bb84..e568f75bb 100644 --- a/HySoP/hysop/domain/discrete.py +++ b/HySoP/hysop/domain/discrete.py @@ -5,16 +5,16 @@ Physical domain discretization """ +from abc import ABCMeta, abstractmethod -from abc import ABCMeta,abstractmethod class DiscreteDomain: """ Abstract description of a discretized physical domain. """ - __metaclass__=ABCMeta + __metaclass__ = ABCMeta @abstractmethod - def __init__(self,domain=None): + def __init__(self, domain=None): """ Constructor. Create a DiscreteDomain with a given discretization. diff --git a/HySoP/hysop/domain/domain.py b/HySoP/hysop/domain/domain.py index 15935e370..2779b66d3 100644 --- a/HySoP/hysop/domain/domain.py +++ b/HySoP/hysop/domain/domain.py @@ -1,19 +1,20 @@ # -*- coding: utf-8 -*- """@package parmepy.domain.domain -Classes for physical domains description. """ +Classes for physical domains description. +""" +from abc import ABCMeta, abstractmethod -from abc import ABCMeta,abstractmethod class Domain: """Abstract description of physical domain. """ - __metaclass__=ABCMeta + __metaclass__ = ABCMeta @abstractmethod def __init__(self, dimension): """ - + @param dimension integer : domain dimension. """ @@ -23,7 +24,7 @@ class Domain: self.discreteDomain = None @abstractmethod - def discretize(self,resolution=None): + def discretize(self, resolution=None): """ @param resolution : discretization specifications. """ diff --git a/HySoP/hysop/domain/grid.py b/HySoP/hysop/domain/grid.py index c6507a9ad..fe13e3149 100644 --- a/HySoP/hysop/domain/grid.py +++ b/HySoP/hysop/domain/grid.py @@ -7,12 +7,12 @@ Cartesian grid definition from .discrete import DiscreteDomain import numpy as np + class CartesianGrid(DiscreteDomain): """ Discrete box representation as a cartesian grid. """ - - def __init__(self,resolution,domain): - DiscreteDomain.__init__(self,domain) - assert(self.dimension==len(resolution)) + def __init__(self, resolution, domain): + DiscreteDomain.__init__(self, domain) + assert(self.dimension == len(resolution)) self.origin = domain.origin self.length = domain.length self.resolution = resolution @@ -51,7 +51,7 @@ class CartesianGrid(DiscreteDomain): """ ToString method. """ - s = str(self.dimension)+"D cartesian grid with resolution equal to : "+str(self.resolution)+".\n" + s = str(self.dimension) + "D cartesian grid with resolution equal to : " + str(self.resolution) + ".\n" return s if __name__ == "__main__": diff --git a/HySoP/hysop/fields/analytical.py b/HySoP/hysop/fields/analytical.py index a77eb886b..7e6451064 100644 --- a/HySoP/hysop/fields/analytical.py +++ b/HySoP/hysop/fields/analytical.py @@ -6,13 +6,14 @@ from .continuous import ContinuousField from .discrete import DiscreteField + class AnalyticalField(ContinuousField): """ A variable (continuous) defined with an analytic formula. """ - def __init__(self, dimension, domain, formula=None, scalar=False, name=""): + def __init__(self, domain, name="", formula=None): """ Constructor. Create an AnalyticalField from a formula. @@ -21,22 +22,20 @@ class AnalyticalField(ContinuousField): @param dimension : variable dimension. @param formula : function defining the variable. """ - ContinuousField.__init__(self, dimension, domain) + ContinuousField.__init__(self, domain, name) ## Analytic formula. self.formula = formula - ## Is scalar variable - self.scalar = scalar - self.name = name - def discretize(self, d_spec=None): + def discretize(self, topology=None): """ AnalyticalField discretization method. - Create an DiscreteField.DiscreteField from given specifications. - - @param d_spec : discretization specifications, not used. + Create an DiscreteField from given topology. """ - if self.discreteField is None: - self.discreteField = DiscreteField(domain=self.domain.discreteDomain, dimension=self.dimension, initialValue=self.formula, scalar=self.scalar, spec=d_spec, name=self.name) + self.__fieldId += 1 + self.discreteField.append(ScalarField(self, topology, name=self.name + "_D_" + str(self.__fieldId), + idFromParent=self.__fieldId)) + self.discreteField[self.__fieldId].initialize(self.formula) + return self.discreteField[self.__fieldId], self.__fieldId def value(self, pos): """ diff --git a/HySoP/hysop/fields/continuous.py b/HySoP/hysop/fields/continuous.py index c7557d358..09d8b5909 100644 --- a/HySoP/hysop/fields/continuous.py +++ b/HySoP/hysop/fields/continuous.py @@ -3,13 +3,13 @@ @package parmepy.fields.continuous Continuous variable description """ - from .discrete import ScalarField + class ContinuousField(object): """ A variable defined on a physical domain """ - def __init__(self,domain,name="?"): + def __init__(self, domain, name="?"): """ Constructor. Create a ContinuousField. @@ -30,23 +30,24 @@ class ContinuousField(object): ## list of the various discretizations of this field self.discreteField = [] - def discretize(self,topology=None): + def discretize(self, topology=None): """ discretization of the field on a topology """ self.__fieldId += 1 - self.discreteField.append(ScalarField(self,topology,name=self.name+"_D_"+str(self.__fieldId),idFromParent=self.__fieldId)) - return self.discreteField[self.__fieldId],self.__fieldId + self.discreteField.append(ScalarField(self, topology, name=self.name + "_D_" + str(self.__fieldId), + idFromParent=self.__fieldId)) + return self.discreteField[self.__fieldId], self.__fieldId def __str__(self): """ Field info display """ - s = self.name + ' , ' + str(self.dimension)+'D field with the following discretizations:\n' + s = self.name + ' , ' + str(self.dimension) + 'D field with the following discretizations:\n' if len(self.discreteField) != 0: for i in range(len(self.discreteField)): s += self.discreteField[i].__str__() - else : - s+="None." + else: + s += "None." return s diff --git a/HySoP/hysop/fields/discrete.py b/HySoP/hysop/fields/discrete.py index 9ffe7aec6..408351a5e 100644 --- a/HySoP/hysop/fields/discrete.py +++ b/HySoP/hysop/fields/discrete.py @@ -3,52 +3,58 @@ @package parmepy.fields.discrete """ - import numpy as np from ..constants import * import evtk.hl as evtk + class ScalarField(object): """ A scalar field, defined on each grid of each subdomain of the given topology. - + """ - def __init__(self,parent,topology=None,name="?",idFromParent=None): + def __init__(self, parent, topology=None, name="?", idFromParent=None): if(topology is not None): self.topology = topology - else : + else: raise NotImplementedError() - + self.name = name self.dimension = topology.domain.dimension resolution = self.topology.mesh.resolution - # zeros or empty??? - self.data = np.zeros((resolution),dtype=PARMES_REAL,order=ORDER) - self.__parentField=parent + ## \todo is numpy array zeros or empty??? + self.data = np.zeros((resolution), dtype=PARMES_REAL, order=ORDER) + self.__parentField = parent self.__idFromParent = idFromParent - + def __str__(self): """ Display class information """ - s = '['+str(self.topology.rank)+'] ' - s += " id "+ str(self.__idFromParent)+", " - s+= self.name+" "+str(self.dimension)+'D discrete field with resolution ' - s += str(self.data.shape)+"." + s = '[' + str(self.topology.rank) + '] ' + s += " id " + str(self.__idFromParent) + ", " + s += self.name + " " + str(self.dimension) + 'D discrete field with resolution ' + s += str(self.data.shape) + "." return s + "\n" - def __getitem__(self,i): + def __getitem__(self, i): """ Access to the content of the field """ return self.data.__getitem__(i) - def __setitem__(self,i,value): + def __setitem__(self, i, value): """ Set the content of the field component at position i Usage : A = ScalarField(topo) A[2,1,1] = 12.0 # Calls A.data[2,1,1] = 12.0 """ - self.data.__setitem__(i,value) - + self.data.__setitem__(i, value) + + def initialize(self, formula=None): + """ + Initialize values with given formula + \todo Ecrire l'initialisation efficace en python. + """ + raise NotImplementedError("Not yet implemented") ## def init(self): ## if not self.initialValue is None: @@ -69,41 +75,49 @@ class ScalarField(object): ## self.contains_data = True ## else: ## raise ValueError("Creating DiscreteVariable with incorrect domain dimension.") - - def tofile(self,filename): - evtk.imageToVTK(filename, pointData = {"scalar" : self.data} ) + + def tofile(self, filename): + evtk.imageToVTK(filename, pointData={"scalar": self.data}) + class VectorField(object): """ A vector field, defined on each grid of each subdomain of the given topology. - + """ - - def __init__(self,topology,name=""): + + def __init__(self, topology, name=""): self.topology = topology self.name = name self.dimension = topology.domain.dimension resolution = self.topology.mesh.resolution - self.data = np.zeros((resolution),dtype=PARMES_REAL) - + self.data = np.zeros((resolution), dtype=PARMES_REAL, order=ORDER) + def __str__(self): """ Display class information """ - s = self.name+": "+str(self.dimension)+"D scalar field of shape " + str(self.data.shape) + s = self.name + ": " + str(self.dimension) + "D scalar field of shape " + str(self.data.shape) return s + "\n" - def __getitem__(self,i): + def __getitem__(self, i): """ Access to the content of the field """ return self.data.__getitem__(i) - def __setitem__(self,i,value): + def __setitem__(self, i, value): """ Set the content of the field component at position i Usage : A = ScalarField(topo) A[2,1,1] = 12.0 # Calls A.data[2,1,1] = 12.0 """ - self.data.__setitem__(i,value) - + self.data.__setitem__(i, value) + + def initialize(self, formula): + """ + Initialize values with given formula + \todo Ecrire l'initialisation efficace en python. + """ + raise NotImplementedError("Not yet implemented") + if __name__ == "__main__": print __doc__ print "- Provided class : ScalarField" diff --git a/HySoP/hysop/fields/topology.py b/HySoP/hysop/fields/topology.py index 70f6ad4ca..0b74994e2 100644 --- a/HySoP/hysop/fields/topology.py +++ b/HySoP/hysop/fields/topology.py @@ -1,143 +1,142 @@ """ @package parmepy.domain.topology -MPI Topologies +MPI Topologies """ import numpy as np import mpi4py.MPI as MPI from ..constants import * + class CartesianTopology(object): - """ + """ + Define an MPI cartesian topology with an associated mesh for each sub-domain. + Keyword arguments : + - domain : the geometry; it must be a box. + - resolution : global resolution + - dim : dimension of the topology + - comm : MPI communicator used to create this topology + - periods : periodicity of the topology (in each direction) + - ghosts : number of poinst in the ghost layer - Define an MPI cartesian topology with an associated mesh for each sub-domain. - Keyword arguments : - - domain : the geometry; it must be a box. - - resolution : global resolution - - dim : dimension of the topology - - comm : MPI communicator used to create this topology - - periods : periodicity of the topology (in each direction) - - ghosts : number of poinst in the ghost layer + """ + def __init__(self, domain, resolution, dim=None, dims=None, comm=MPI.COMM_WORLD, periods=None, ghosts=None): + ## Associated domain + self.domain = domain + # Compute the "optimal" processus distribution for each direction of the grid topology + nbprocs = comm.Get_size() + if(dims is None): + assert(dim is not None) + self.dims = np.asarray(MPI.Compute_dims(nbprocs, dim)) + # Topology dimension + self.dim = dim + else: + self.dims = np.asarray(dims) + self.dim = self.dims.size + # Define the topology + # default period status is periodic + if(periods is None): + self.periods = self.dim * (True,) + self.topo = comm.Create_cart(self.dims, periods=self.periods) - """ - def __init__(self,domain,resolution,dim=None,dims=None,comm=MPI.COMM_WORLD,periods=None,ghosts=None): + # Size of the topology + self.size = self.topo.Get_size() + # Rank of the current process, in the new topology + self.rank = self.topo.Get_rank() + # Coordinates of the current process + self.coords = self.topo.Get_coords(self.rank) + # Neighbours + # self.neighbours = np.zeros((dim,2)) + self.down, self.up = self.topo.Shift(XDIR, 1) + if(self.dim > 1): + self.west, self.east = self.topo.Shift(YDIR, 1) + if(self.dim > 2): + self.south, self.north = self.topo.Shift(ZDIR, 1) + # ghost layer (default = 0) + if(ghosts is None): + self.ghosts = np.zeros((self.domain.dimension)) + # Global resolution + self.resolution = np.asarray(resolution) + nbpoints = self.resolution[:self.dim] // self.dims + remainingPoints = self.resolution[:self.dim] % self.dims + localResolution = self.resolution.copy() + localResolution[:self.dim] = nbpoints + for i in range(self.dim): + if(self.coords[i] == self.dims[i] - 1): + localResolution[i] = nbpoints[i] + remainingPoints[i] + start = np.zeros((domain.dimension)) + start[:self.dim] = self.coords * nbpoints + self.mesh = LocalMesh(self.rank, resolution=localResolution, start=start, ghosts=self.ghosts) - ## Associated domain - self.domain=domain - # Compute the "optimal" processus distribution for each direction of the grid topology - nbprocs = comm.Get_size() - if(dims is None): - assert(dim is not None) - self.dims=np.asarray(MPI.Compute_dims(nbprocs,dim)) - # Topology dimension - self.dim=dim - else: - self.dims=np.asarray(dims) - self.dim = self.dims.size - # Define the topology - # default period status is periodic - if(periods is None): - self.periods = self.dim*(True,) - self.topo = comm.Create_cart(self.dims,periods=self.periods) + def __str__(self): + """ Topology info display """ + s = '=======================================================\n' + if(self.rank == 0): + s += str(self.dim) + 'D cartesian Topology of size ' + str(self.dims) + '\n' + s += str(self.mesh) + s += '=======================================================\n' + return s - # Size of the topology - self.size = self.topo.Get_size() - # Rank of the current process, in the new topology - self.rank = self.topo.Get_rank() - # Coordinates of the current process - self.coords = self.topo.Get_coords(self.rank) - # Neighbours - # self.neighbours = np.zeros((dim,2)) - self.down,self.up=self.topo.Shift(XDIR,1) - if(self.dim>1) : - self.west,self.east=self.topo.Shift(YDIR,1) - if(self.dim>2) : - self.south,self.north=self.topo.Shift(ZDIR,1) - # ghost layer (default = 0) - if(ghosts is None): - self.ghosts = np.zeros((self.domain.dimension)) - # Global resolution - self.resolution = np.asarray(resolution) - nbpoints = self.resolution[:self.dim]//self.dims - remainingPoints = self.resolution[:self.dim]%self.dims - localResolution = self.resolution.copy() - localResolution[:self.dim] = nbpoints - for i in range(self.dim): - if(self.coords[i] == self.dims[i]-1): - localResolution[i] = nbpoints[i]+remainingPoints[i] - start = np.zeros((domain.dimension)) - start[:self.dim]=self.coords*nbpoints - self.mesh = LocalMesh(self.rank,resolution=localResolution,start=start,ghosts=self.ghosts) - - def __str__(self): - """ Topology info display """ - s ='=======================================================\n' - if(self.rank==0): - s += str(self.dim)+'D cartesian Topology of size '+str(self.dims)+'\n' - s += str(self.mesh) - s +='=======================================================\n' - return s class FFTTopology(object): - """ A 2D or 3D MPI cartesian topology - - """ - - def __init__(self, dim=2,comm=MPI.COMM_WORLD,nbprocs=MPI.COMM_WORLD.Get_size(),periods=3*(True,),dims=(1,1,1)): + """ + A 2D or 3D MPI cartesian topology + """ - # Topology dimension - self.dim=dim - # Compute the "optimal" processus distribution for each direction of the grid topology - dims=MPI.Compute_dims(nbprocs,dim) - self.dims=np.ones((dim+1)) - self.dims[0:dim] = np.asarray(dims) - # Define the topology - self.topo = comm.Create_cart(self.dims,periods=periods[0:dim+1]) - # Size of the topology - sizeT = self.topo.Get_size() - # Rank of the current process - self.rank = self.topo.Get_rank() - # Coordinates of the current process - self.coords = self.topo.Get_coords(self.rank) - # Neighbours - # self.neighbours = np.zeros((dim,2)) - self.down,self.up=self.topo.Shift(XDIR,1) - if(dim>1) : - self.west,self.east=self.topo.Shift(YDIR,1) - if(dim>2) : - self.south,self.north=self.topo.Shift(ZDIR,1) + def __init__(self, dim=2, comm=MPI.COMM_WORLD, nbprocs=MPI.COMM_WORLD.Get_size(), periods=3 * (True,), dims=(1, 1, 1)): + # Topology dimension + self.dim = dim + # Compute the "optimal" processus distribution for each direction of the grid topology + dims = MPI.Compute_dims(nbprocs, dim) + self.dims = np.ones((dim + 1)) + self.dims[0:dim] = np.asarray(dims) + # Define the topology + self.topo = comm.Create_cart(self.dims, periods=periods[0:dim + 1]) + # Size of the topology + sizeT = self.topo.Get_size() + # Rank of the current process + self.rank = self.topo.Get_rank() + # Coordinates of the current process + self.coords = self.topo.Get_coords(self.rank) + # Neighbours + # self.neighbours = np.zeros((dim,2)) + self.down, self.up = self.topo.Shift(XDIR, 1) + if(dim > 1): + self.west, self.east = self.topo.Shift(YDIR, 1) + if(dim > 2): + self.south, self.north = self.topo.Shift(ZDIR, 1) + + def __str__(self): + """ Topology info display """ + s = '=======================================================' + s += str(self.dim) + 'D FFT Topology of size ' + str(self.dims) + s += self.mesh.__str__ + s += '=======================================================' + return s - def __str__(self): - """ Topology info display """ - s ='=======================================================' - s += str(self.dim)+'D FFT Topology of size '+str(self.dims) - s+=self.mesh.__str__ - s+='=======================================================' - return s class LocalMesh(object): - """ - """ + """ + """ + def __init__(self, rank, resolution, start, ghosts=np.zeros((3))): + # Current process rank in the topology that owns this mesh + self.rank = rank + # Local resolution + self.resolution = resolution.copy() + 2 * ghosts + # index of the lower point (in each dir) in the global mesh + self.start = start + # index of the upper point (in each dir), global mesh + self.end = self.start + self.resolution - 1 + # Mesh step size + + def __str__(self): + """ Local mesh display """ + s = '[' + str(self.rank) + '] Local mesh resolution :' + str(self.resolution) + '\n' + s += 'Global indices :' + str(self.start) + '\n' + return s - def __init__(self,rank,resolution,start,ghosts=np.zeros((3))) : - # Current process rank in the topology that owns this mesh - self.rank = rank - # Local resolution - self.resolution = resolution.copy()+2*ghosts - # index of the lower point (in each dir) in the global mesh - self.start = start - # index of the upper point (in each dir), global mesh - self.end = self.start + self.resolution - 1 - # Mesh step size - def __str__(self): - """ Local mesh display """ - s = '['+str(self.rank)+'] Local mesh resolution :'+str(self.resolution)+'\n' - s+= 'Global indices :'+str(self.start)+'\n' - return s - - -if __name__ == "__main__" : - print "This module defines the following classes:" - print "- CartesianTopology: ", CartesianTopology.__doc__ - print "- FFTTopology: ", FFTTopology.__doc__ - print "- LocalMesh: ", LocalMesh.__doc__ +if __name__ == "__main__": + print "This module defines the following classes:" + print "- CartesianTopology: ", CartesianTopology.__doc__ + print "- FFTTopology: ", FFTTopology.__doc__ + print "- LocalMesh: ", LocalMesh.__doc__ diff --git a/HySoP/hysop/operator/Advection.py b/HySoP/hysop/operator/Advection.py index 1649f1016..144b51902 100644 --- a/HySoP/hysop/operator/Advection.py +++ b/HySoP/hysop/operator/Advection.py @@ -1,11 +1,11 @@ # -*- coding: utf-8 -*- """ -@package Operator -Operator representation +@package parmepy.operator.Advection + +Advection operator representation """ -from ..Param import * -from ContinuousOperator import ContinuousOperator -from AdvectionDOp import AdvectionDOp +from .continuous import ContinuousOperator +from .advection_d import AdvectionDOp class Advection(ContinuousOperator): @@ -18,15 +18,14 @@ class Advection(ContinuousOperator): Constructor. Create an Advection operator from given variables velocity and scalar. - @param velocity ContinuousVariable.ContinuousVariable : velocity variable. - @param scalar ContinuousVariable.ContinuousVariable : scalar variable. + @param velocity ContinuousField : velocity variable. + @param scalar ContinuousField : scalar variable. """ ContinuousOperator.__init__(self) ## advection velocity variable self.velocity = velocity ## advected scalar variable self.scalar = scalar - self.addVariable([self.velocity, self.scalar]) def discretize(self, spec=None): """ diff --git a/HySoP/hysop/operator/__init__.py b/HySoP/hysop/operator/__init__.py index f1513ea05..b6378e5b4 100644 --- a/HySoP/hysop/operator/__init__.py +++ b/HySoP/hysop/operator/__init__.py @@ -1,8 +1,6 @@ -from ContinuousOperator import ContinuousOperator -from Advection import Advection -from DiscreteOperator import DiscreteOperator -from AdvectionDOp import AdvectionDOp -from InterpolationDOp import InterpolationDOp -from RemeshingDOp import RemeshingDOp -from TagDOp import TagDOp -from VelocityOp import VelocityOp +""" +@package parmepy.operator + +Everything concerning operators. + +""" diff --git a/HySoP/hysop/operator/AdvectionDOp.py b/HySoP/hysop/operator/advection_d.py similarity index 97% rename from HySoP/hysop/operator/AdvectionDOp.py rename to HySoP/hysop/operator/advection_d.py index c13f0d61c..8aaab8ea2 100644 --- a/HySoP/hysop/operator/AdvectionDOp.py +++ b/HySoP/hysop/operator/advection_d.py @@ -1,15 +1,12 @@ # -*- coding: utf-8 -*- """ -@package Operator -Operator representation +@package operator +Discrete advection representation """ -from ..Param import * -from DiscreteOperator import DiscreteOperator +from .discrete import DiscreteOperator import pyopencl as cl import time -providedClass = "AdvectionDOp" - class AdvectionDOp(DiscreteOperator): """ diff --git a/HySoP/hysop/operator/ContinuousOperator.py b/HySoP/hysop/operator/continuous.py similarity index 59% rename from HySoP/hysop/operator/ContinuousOperator.py rename to HySoP/hysop/operator/continuous.py index a5b83bda1..6241f5617 100644 --- a/HySoP/hysop/operator/ContinuousOperator.py +++ b/HySoP/hysop/operator/continuous.py @@ -1,9 +1,10 @@ # -*- coding: utf-8 -*- """ -@package Operator +@package parmepy.operator.continuous + Operator representation """ -from ..Param import * +from abc import ABCMeta, abstractmethod class ContinuousOperator: @@ -11,6 +12,9 @@ class ContinuousOperator: Continuous operator abstract description. """ + __metaclass__ = ABCMeta + + @abstractmethod def __init__(self): """ Constructor. @@ -18,24 +22,10 @@ class ContinuousOperator: """ ## Application domains of the variables. self.domains = [] - ## Variables - self.variables = [] ## Operator discretization. self.discreteOperator = None - def addVariable(self, cVariable): - """ - Add an continuous variables to the operator. - Also add variables' domains to the operator. - - @param cVariable ContinuousVariable.ContinuousVariable : variables to add. - """ - for v in cVariable: - if self.variables.count(v) == 0: - self.variables.append(v) - if self.domains.count(v.domain) == 0: - self.domains.append(v.domain) - + @abstractmethod def discretize(self, spec=None): """ Abstract method. diff --git a/HySoP/hysop/operator/DiscreteOperator.py b/HySoP/hysop/operator/discrete.py similarity index 70% rename from HySoP/hysop/operator/DiscreteOperator.py rename to HySoP/hysop/operator/discrete.py index c95859de8..d816c828b 100644 --- a/HySoP/hysop/operator/DiscreteOperator.py +++ b/HySoP/hysop/operator/discrete.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- """ -@package Operator -Operator representation +@package operator +Discrete operator representation """ -from ..Param import * +from abc import ABCMeta, abstractmethod class DiscreteOperator: @@ -11,6 +11,9 @@ class DiscreteOperator: Abstract description of a discretized operator. """ + __metaclass__ = ABCMeta + + @abstractmethod def __init__(self): """ Constructor. @@ -18,27 +21,12 @@ class DiscreteOperator: """ ## Application domains of the variables. self.domains = [] - ## Variables - self.variables = [] ## Operator numerical method. self.numMethod = [] self.is_splittable = True self.gpu_kernel = None self.gpu_kernel_name = "" - def addVariable(self, cVariable): - """ - Add an discrete variables to the operator. - Also add variables' domains to the operator. - - @param cVariable DiscreteVariable.DiscreteVariable : variables to add. - """ - for v in cVariable: - if self.variables.count(v) == 0: - self.variables.append(v) - if self.domains.count(v.domain) == 0: - self.domains.append(v.domain) - def setMethod(self, method): """ Set the numerical method used by operator when calling applyOperator. @@ -47,6 +35,7 @@ class DiscreteOperator: """ self.numMethod = method + @abstractmethod def setResultVariable(self): """ Abstract method, apply operaton on a variable. @@ -54,6 +43,7 @@ class DiscreteOperator: """ raise NotImplementedError("Need to override method in a subclass of " + providedClass) + @abstractmethod def applyOperator(self): """ Abstract method, apply operaton on a variable. -- GitLab