Commit ff19ab63 authored by Dmitry I. Lyakh's avatar Dmitry I. Lyakh
Browse files

Implementing user API for NumServer.

parent d4882724
......@@ -5,18 +5,20 @@ add_library(${LIBRARY_NAME}
basis_vector.cpp
space_basis.cpp
spaces.cpp
tensor_signature.cpp
space_register.cpp
tensor_shape.cpp
tensor_signature.cpp
tensor_leg.cpp
tensor.cpp
tensor_connected.cpp
space_register.cpp
tensor_operation.cpp
tensor_op_create.cpp
tensor_op_destroy.cpp
tensor_op_transform.cpp
tensor_op_add.cpp
tensor_op_contract.cpp
tensor_op_factory.cpp
tensor_network.cpp
num_server.cpp)
target_include_directories(${LIBRARY_NAME}
......
/** ExaTN::Numerics: Numerical server
REVISION: 2019/05/27
REVISION: 2019/05/31
Copyright (C) 2018-2019 Dmitry I. Lyakh (Liakh)
Copyright (C) 2018-2019 Oak Ridge National Laboratory (UT-Battelle) **/
......@@ -32,6 +32,62 @@ std::shared_ptr<BytePacket> NumServer::getExternalData(const std::string & tag)
return ext_data_[tag];
}
ScopeId NumServer::openScope(const std::string & scope_name)
{
//`Finish
return 0;
}
ScopeId NumServer::closeScope()
{
auto prev_scope = scopes_.top();
scopes_.pop();
return prev_scope;
}
SpaceId NumServer::createVectorSpace(const std::string & space_name, DimExtent space_dim,
const VectorSpace ** space_ptr)
{
//`Finish
return 0;
}
void NumServer::destroyVectorSpace(const std::string & space_name)
{
//`Finish
return;
}
void NumServer::destroyVectorSpace(SpaceId space_id)
{
//`Finish
return;
}
SubspaceId NumServer::createSubspace(const std::string & subspace_name,
const std::string & space_name,
const std::pair<DimOffset,DimOffset> bounds,
const Subspace ** subspace_ptr)
{
//`Finish
return 0;
}
void NumServer::destroySubspace(const std::string & subspace_name)
{
//`Finish
return;
}
void NumServer::destroySubspace(SubspaceId subspace_id)
{
//`Finish
return;
}
} //namespace numerics
} //namespace exatn
/** ExaTN::Numerics: Numerical server
REVISION: 2019/05/27
REVISION: 2019/05/31
Copyright (C) 2018-2019 Dmitry I. Lyakh (Liakh)
Copyright (C) 2018-2019 Oak Ridge National Laboratory (UT-Battelle) **/
......@@ -18,6 +18,7 @@ Copyright (C) 2018-2019 Oak Ridge National Laboratory (UT-Battelle) **/
#include <memory>
#include <string>
#include <stack>
#include <map>
using exatn::Identifiable;
......@@ -49,6 +50,36 @@ public:
/** Retrieves a registered external data packet. **/
std::shared_ptr<BytePacket> getExternalData(const std::string & tag);
/** Opens a new (child) TAProL scope and returns its id. **/
ScopeId openScope(const std::string & scope_name); //new scope name
/** Closes the currently open TAProL scope and returns its parental scope id. **/
ScopeId closeScope();
/** Creates a named vector space, returns its registered id, and,
optionally, a non-owning pointer to it. **/
SpaceId createVectorSpace(const std::string & space_name, //in: vector space name
DimExtent space_dim, //in: vector space dimension
const VectorSpace ** space_ptr = nullptr); //out: non-owning pointer to the created vector space
/** Destroys a previously created named vector space. **/
void destroyVectorSpace(const std::string & space_name); //in: name of the vector space to destroy
void destroyVectorSpace(SpaceId space_id); //in: id of the vector space to destroy
/** Creates a named subspace of a named vector space,
returns its registered id, and, optionally, a non-owning pointer to it. **/
SubspaceId createSubspace(const std::string & subspace_name, //in: subspace name
const std::string & space_name, //in: containing vector space name
const std::pair<DimOffset,DimOffset> bounds, //in: range of basis vectors defining the created subspace: [
const Subspace ** subspace_ptr = nullptr); //out: non-owning pointer to the created subspace
/** Destroys a previously created named subspace. **/
void destroySubspace(const std::string & subspace_name); //in: name of the subspace to destroy
void destroySubspace(SubspaceId subspace_id);
private:
SpaceRegister space_register_; //register of vector spaces and their named subspaces
......@@ -57,6 +88,8 @@ private:
std::map<std::string,std::shared_ptr<TensorMethod<Identifiable>>> ext_methods_; //external tensor methods
std::map<std::string,std::shared_ptr<BytePacket>> ext_data_; //external data
std::stack<ScopeId> scopes_; //TAProL scope stack
};
} //namespace numerics
......
......@@ -32,8 +32,6 @@ Copyright (C) 2018-2019 Oak Ridge National Laboratory (UT-Battelle) **/
namespace exatn{
using ScopeId = unsigned int; //TAProL scope ID type
namespace numerics{
/** Opens a new (child) TAProL scope and returns its id. **/
......
......@@ -22,6 +22,8 @@ using SymmetryId = int; //symmetry id type
using DimExtent = unsigned long long int; //dimension extent type
using DimOffset = unsigned long long int; //dimension base offset type
using ScopeId = unsigned int; //TAProL scope ID type
constexpr DimExtent MAX_SPACE_DIM = 0xFFFFFFFFFFFFFFFF; //max dimension of unregistered (anonymous) spaces
constexpr SpaceId SOME_SPACE = 0; //any unregistered (anonymous) space (all registered spaces will have SpaceId > 0)
constexpr SubspaceId FULL_SUBSPACE = 0; //every space has its trivial (full) subspace automatically registered as subspace 0
......
/** ExaTN::Numerics: Tensor network
REVISION: 2019/05/31
Copyright (C) 2018-2019 Dmitry I. Lyakh (Liakh)
Copyright (C) 2018-2019 Oak Ridge National Laboratory (UT-Battelle) **/
#include "tensor_network.hpp"
namespace exatn{
namespace numerics{
} //namespace numerics
} //namespace exatn
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment