UniformDB#
If the values for a field a uniform (same everywhere), then a UniformDB
or SimpleDB
should be used.
The main difference between the two is that a UniformDB
is specified programmatically, whereas a SimpleDB
is specified using a data file.
If the values are used in multiple places, then it is usually easier to create a SimpleDB
data file and reuse it rather than creating a UniformDB
programmatically each time.
Pyre User Interface
See UniformDB component.
ZeroDB#
PyLith provides a special case of a UniformDB
, called ZeroDB
, with values set to zero for Dirichlet boundary conditions.
Examples#
We create a UniformDB
specifying a density of 2500 kg/m\(^3\) and a shear modulus of 30 GPa.
// Data to populate UniformDB.
const size_t numValues = 2;
const char* names[numValues] = { "density", "shear_modulus" };
const char* units[numValues] = { "kg/m**3", "GPa" };
const double values[numValues] = { 2500.0, 30.0 };
// Create UniformDB 'db; and set the values.
spatialdata::spatialdb::UniformDB db;
db.setData(names, units, values, numValues);
Python applications should use the Pyre framework for creating the UniformDB
.
We show how to do it programmatically in Python for completeness.
from spatialdata.spatialdb.UniformDB import UniformDB
db = UniformDB()
db.values = ["density", "shear_modulus"]
db.data = ["2500*kg/m**3", "30.0*GPa"]
db._configure()