Package solvcon :: Package io :: Module domain :: Class DomainFormat
[hide private]
[frames] | no frames]

Class DomainFormat

source code

 object --+    
          |    
core.Format --+
              |
             DomainFormat
Known Subclasses:

Nested Classes [hide private]
  __metaclass__
Sum the length of all META_ entries of bases and derived classes; only collect from 1 level of parents.
Instance Methods [hide private]
 
__init__(self, **kw)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
solvcon.gendata.AttributeDict
read_meta(self, dirname)
Read meta-data from directory
source code
 
save(self, dom, dirname)
Save the dom object into a file.
source code
solvcon.domain.Collective
load(self, dirname, bcmapper, with_arrs, with_whole, with_split, return_filenames, domaintype)
Load domain file in the specified directory with BC mapper applied.
source code
solvcon.block.Block
load_block(self, dirname, blkid, bcmapper, blkfn=None)
Load block file in the specified directory with BC mapper applied.
source code
 
_save_meta(self, dom, stream)
Returns: nothing.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Methods [hide private]
list
_load_idxinfo_shape(cls, meta, lines)
Returns: length of indices.
source code
str, list of str
_load_block_filename(cls, meta, lines)
Returns: filenames for whole and split blocks.
source code

Inherited from core.Format (private): _get_textpart, _parse_meta

Static Methods [hide private]
 
_save_idxinfo_shape(dom, stream) source code
 
_save_block_filenames(dirname, dom, stream) source code

Inherited from core.Format (private): _read_array, _write_array

Class Variables [hide private]
  FILE_HEADER = '-*- solvcon dom file -*-'
header of the format; must be overridden.
  DOM_FILENAME = 'domain.dom'
  WHOLE_FILENAME = 'whole.blk'
  SPLIT_FILENAME = 'part%d.blk'
  SPEC_OF_META = (('GLOBAL', <type 'str'>), ('SWITCH', <function...
the order and converter of each meta-data section occured in the text part; must be overridden.
  META_GLOBAL = ('FORMAT_REV', 'compressor', 'blk_format_rev')
global meta entries.
  META_SWITCH = ()
optional flags.
  META_SHAPE = ('edgecut', 'nnode', 'nface', 'ncell', 'npart', '...
  meta_length = 10
length of all META_ entries; calculated by FormatMeta.

Inherited from core.Format: BINARY_MARKER, FORMAT_REV, READ_BLOCK

Instance Variables [hide private]
  blk_format_rev
the format (revision) of block to be saved.
  compressor
the compression to use: '', 'gz', or 'bz2'
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, **kw)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

read_meta(self, dirname)

source code 

Read meta-data from directory

Parameters:
  • dirname (str) - directory to be read.
Returns: solvcon.gendata.AttributeDict
meta-data, raw text lines of meta-data, and the length of meta-data in bytes.
Overrides: core.Format.read_meta

save(self, dom, dirname)

source code 

Save the dom object into a file.

Parameters:
  • dom (solvcon.domain.Collective) - to-be-written domain object; must be split.
  • dirname (str) - the directory to save data.

load(self, dirname, bcmapper, with_arrs, with_whole, with_split, return_filenames, domaintype)

source code 

Load domain file in the specified directory with BC mapper applied.

Parameters:
  • dirname (str) - directory name of domain.
  • bcmapper (dict) - BC type mapper.
  • with_arrs (bool) - load arrays for domain object.
  • with_whole (bool) - load whole block.
  • with_split (bool) - load split block as well.
  • return_filenames - also return the relative paths of containing filenames.
  • domaintype (solvcon.domain.Collective) - the type used to instantiate domain object.
  • return (filenames: bool)
Returns: solvcon.domain.Collective
the read domain object.

load_block(self, dirname, blkid, bcmapper, blkfn=None)

source code 

Load block file in the specified directory with BC mapper applied.

Parameters:
  • dirname (str) - directory name of domain.
  • blkid (int or None) - the id of the block to be loaded.
  • bcmapper (dict) - BC type mapper.
  • blkfn (str) - the file name of the block to be loaded; relative path.
Returns: solvcon.block.Block
the read block object.

_save_meta(self, dom, stream)

source code 
Parameters:
  • dom (solvcon.domain.Collective) - partitioned domain object to store.
  • stream (file) - output stream.
Returns:
nothing.

_load_idxinfo_shape(cls, meta, lines)
Class Method

source code 
Parameters:
  • meta (solvcon.gendata.AttributeDict) - meta information dictionary.
  • lines (list) - text data
Returns: list
length of indices.

_load_block_filename(cls, meta, lines)
Class Method

source code 
Parameters:
  • meta (solvcon.gendata.AttributeDict) - meta information dictionary.
  • lines (list) - text data
Returns: str, list of str
filenames for whole and split blocks.

Class Variable Details [hide private]

SPEC_OF_META

the order and converter of each meta-data section occured in the text part; must be overridden.
Value:
(('GLOBAL', <type 'str'>),
 ('SWITCH', <function strbool at 0x31817d0>),
 ('SHAPE', <type 'int'>),
 ('IDXINFO', None))

META_SHAPE

Value:
('edgecut', 'nnode', 'nface', 'ncell', 'npart', 'nifp', 'ndmblk')