Accessing the MemCom Database

The chapter describes how to access data stored on a B2000++ model database. Each section contains Python and in some case C++ API example code. All C/C++ and Python functions can be consulted in the respective manuals. Python database access is described in the MemCom Python module documentation. C and C++ database access functions are described in the MemCom Reference Manual

A MemCom data base (see Introduction) contains datasets describing

  • Mesh

  • Materials

  • Boundary conditions

  • Solutions

  • Administrative data

Open and Close a MemCom Database

Open the MemCom database ‘scordelis_lo-roof.b2m’ in read-only mode, the memcom.db object giving back the database handle object db:

import memcom
name = 'scordelis_lo-roof.b2m'
db = memcom.db(name + '/archives.mc', 'r')

Close the MemCom database (note that the database handle object db is still there but not anymore accessible):

...
db.close()

Save the current content of the MemCom database (“snapshot”):

...
db.save()

Mesh

To create or load the mesh from the database, get at least the following datasets:

Content of a B2000++ database directory

Name

Type

Description

ADIR

int array

Active branch identifier list.

COOR.branch

float array

Node coordinates

NODA.branch

int array

Node parameters.

ETAB.branch

Array of dict

Element connectivites and attributes.

NLCS.branch Node-local transformations

int array

Optional local coordinate systems.

TRANSFORMATIONS

float array

Optional transformations (DOF transformations).