コード例 #1
0
ファイル: softpy-test-entity.py プロジェクト: tankefugl/soft5
def store(e, datamodel):
    softpy.datamodel_append_string(datamodel, 'name', 'NaCl')
    softpy.datamodel_append_int32(datamodel, 'spacegroup_no', 225)
    softpy.datamodel_append_double(datamodel, 'lattice_parameter', 5.64)
    softpy.datamodel_append_array_double(
        datamodel, 'positions',
        np.array([(0.0, 0.0, 0.0), (0.5, 0.5, 0.5)]).flatten())
コード例 #2
0
ファイル: softpy-test-entity.py プロジェクト: NanoSim/Porto
def store(e, datamodel):
    softpy.datamodel_append_string(datamodel, 'name', 'NaCl')
    softpy.datamodel_append_int32(datamodel, 'spacegroup_no', 225)
    softpy.datamodel_append_double(datamodel, 'lattice_parameter', 5.64)
    softpy.datamodel_append_array_double(
        datamodel, 'positions', 
        np.array([(0.0, 0.0, 0.0), (0.5, 0.5, 0.5)]).flatten())
コード例 #3
0
storage = softpy.storage_create('hdf5', 'softpy-test-datamodel.h5')
#storage = softpy.storage_create('mongo2', 'mongodb://localhost/', 'db=something;coll=foo')
strategy = softpy.storage_get_storage_strategy(storage)
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.datamodel_append_int32(model, 'int32', m.int32)
softpy.datamodel_append_double(model, 'double', m.double)
softpy.datamodel_append_string(model, 'string', m.string)
#softpy.datamodel_append_blob(model, 'blob', m.blob)
softpy.datamodel_append_array_int32(model, 'int32_array', m.int32_array)
softpy.datamodel_append_array_double(model, 'double_array', m.double_array)
softpy.datamodel_append_array_double_2d(model, 'double_array_2d',
                                        m.double_array_2d)
softpy.datamodel_append_array_double_3d(model, 'double_array_3d',
                                        m.double_array_3d)
softpy.datamodel_append_string_list(model, 'string_list', m.string_list)

softpy.storage_strategy_store(strategy, model)
softpy.storage_free(storage)

# Load
storage = softpy.storage_create('hdf5', 'softpy-test-datamodel.h5')
#storage = softpy.storage_create('mongo2', 'mongodb://localhost/', 'db=something;coll=foo')
strategy = softpy.storage_get_storage_strategy(storage)
model = softpy.storage_strategy_get_datamodel(strategy)
コード例 #4
0
ファイル: softpy-test-entity.py プロジェクト: tankefugl/soft5
 def store(self, e, datamodel):
     softpy.datamodel_append_string(datamodel, 'name', self.name)
     softpy.datamodel_append_int32(datamodel, 'age', self.age)
     softpy.datamodel_append_array_double(
         datamodel, 'distances', self.distances)
コード例 #5
0
#storage = softpy.storage_create('mongo2', 'mongodb://localhost/', 'db=something;coll=foo')
strategy = softpy.storage_get_storage_strategy(storage)
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.datamodel_append_int32(model, 'int32', m.int32)
softpy.datamodel_append_double(model, 'double', m.double)
softpy.datamodel_append_string(model, 'string', m.string)
#softpy.datamodel_append_blob(model, 'blob', m.blob)
softpy.datamodel_append_array_int32(
    model, 'int32_array', m.int32_array)
softpy.datamodel_append_array_double(
    model, 'double_array', m.double_array)
softpy.datamodel_append_array_double_2d(
    model, 'double_array_2d', m.double_array_2d)
softpy.datamodel_append_array_double_3d(
    model, 'double_array_3d', m.double_array_3d)
softpy.datamodel_append_string_list(
    model, 'string_list', m.string_list)

softpy.storage_strategy_store(strategy, model)
softpy.storage_free(storage)


# Load
storage = softpy.storage_create('hdf5', 'softpy-test-datamodel.h5')
#storage = softpy.storage_create('mongo2', 'mongodb://localhost/', 'db=something;coll=foo')
strategy = softpy.storage_get_storage_strategy(storage)
コード例 #6
0
ファイル: softpy-test-entity.py プロジェクト: NanoSim/Porto
 def store(self, e, datamodel):
     softpy.datamodel_append_string(datamodel, 'name', self.name)
     softpy.datamodel_append_int32(datamodel, 'age', self.age)
     softpy.datamodel_append_array_double(
         datamodel, 'distances', self.distances)