Exemple #1
0
model = softpy.storage_strategy_get_datamodel(strategy)

softpy.datamodel_set_id(model, m._id)
softpy.datamodel_set_meta_name(model, m._name)
softpy.datamodel_set_meta_version(model, m._version)
softpy.datamodel_set_meta_namespace(model, m._namespace)

softpy.storage_strategy_start_retrieve(strategy, model)

int32 = softpy.datamodel_get_int32(model, 'int32')
assert (int32 == m.int32)

double = softpy.datamodel_get_double(model, 'double')
assert (double == m.double)

string = softpy.datamodel_get_string(model, 'string')
assert (string == m.string)

#blob = softpy.datamodel_get_string(model, 'blob')
#assert(blob == m.blob)

int32_array = softpy.datamodel_get_array_int32(model, 'int32_array')
assert (np.all(int32_array == m.int32_array))

double_array = softpy.datamodel_get_array_double(model, 'double_array')
assert (np.all(double_array == m.double_array))

double_array_2d = softpy.datamodel_get_array_double_2d(model,
                                                       'double_array_2d')
assert (np.all(double_array_2d == m.double_array_2d))
 def load(self, e, datamodel):
     self.name = softpy.datamodel_get_string(datamodel, 'name')
     self.age = softpy.datamodel_get_int32(datamodel, 'age')
     self.distances = softpy.datamodel_get_array_double(
         datamodel, 'distances')
def load(e, datamodel):
    d = e.user_data
    d.name = softpy.datamodel_get_string(datamodel, 'name')
    d.spgr = softpy.datamodel_get_int32(datamodel, 'spacegroup_no')
    d.latt = softpy.datamodel_get_double(datamodel, 'lattice_parameter')
    d.posi = softpy.datamodel_get_array_double(datamodel, 'positions')
model = softpy.storage_strategy_get_datamodel(strategy)

softpy.datamodel_set_id(model, m._id)
softpy.datamodel_set_meta_name(model, m._name)
softpy.datamodel_set_meta_version(model, m._version)
softpy.datamodel_set_meta_namespace(model, m._namespace)

softpy.storage_strategy_start_retrieve(strategy, model)

int32 = softpy.datamodel_get_int32(model, 'int32')
assert(int32 == m.int32)

double = softpy.datamodel_get_double(model, 'double')
assert(double == m.double)

string = softpy.datamodel_get_string(model, 'string')
assert(string == m.string)

#blob = softpy.datamodel_get_string(model, 'blob')
#assert(blob == m.blob)

int32_array = softpy.datamodel_get_array_int32(model, 'int32_array')
assert(np.all(int32_array == m.int32_array))

double_array = softpy.datamodel_get_array_double(model, 'double_array')
assert(np.all(double_array == m.double_array))

double_array_2d = softpy.datamodel_get_array_double_2d(model, 'double_array_2d')
assert(np.all(double_array_2d == m.double_array_2d))

double_array_3d = softpy.datamodel_get_array_double_3d(model, 'double_array_3d')
Exemple #5
0
 def load(self, e, datamodel):
     self.name = softpy.datamodel_get_string(datamodel, 'name')
     self.age = softpy.datamodel_get_int32(datamodel, 'age')
     self.distances = softpy.datamodel_get_array_double(
         datamodel, 'distances')
Exemple #6
0
def load(e, datamodel):
    d = e.user_data
    d.name = softpy.datamodel_get_string(datamodel, 'name')
    d.spgr = softpy.datamodel_get_int32(datamodel, 'spacegroup_no')
    d.latt = softpy.datamodel_get_double(datamodel, 'lattice_parameter')
    d.posi = softpy.datamodel_get_array_double(datamodel, 'positions')