aclVectorOfElementsDef.h
Go to the documentation of this file.
/*
* Advanced Simulation Library <http://asl.org.il>
*
* Copyright 2015 Avtech Scientific <http://avtechscientific.com>
*
*
* This file is part of Advanced Simulation Library (ASL).
*
* ASL is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3 of the License.
*
* ASL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with ASL. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef ACLVECTORELEMENTSDEF_H
#define ACLVECTORELEMENTSDEF_H
#include <memory>
#include <vector>
#include "../aclTypes.h"
using namespace std;
namespace cl
{
class CommandQueue;
}
namespace acl
{
class ElementBase;
class MemBlock;
typedef std::shared_ptr<ElementBase> Element;
typedef std::shared_ptr<MemBlock> ElementData;
class VectorOfElements;
typedef std::shared_ptr<cl::CommandQueue> CommandQueue;
class VectorOfElementsData: public std::vector<ElementData>
{
bool checkCompatibility() const;
public:
bool checkSizesCompatibility(unsigned int n) const;
VectorOfElementsData();
explicit VectorOfElementsData(unsigned int n);
template <typename T> VectorOfElementsData(unsigned int n,
unsigned int s,
T);
template <typename T> VectorOfElementsData(unsigned int n,
unsigned int s,
T,
CommandQueue queue);
VectorOfElements operator=(const VectorOfElements & a) const;
VectorOfElements operator=(const VectorOfElementsData & a) const;
void resizeElements(unsigned int n);
};
class VectorOfElements: public std::vector<Element>
{
bool checkCompatibility() const;
public:
bool checkSizesCompatibility(unsigned int n) const;
VectorOfElements();
explicit VectorOfElements(unsigned int n);
VectorOfElements(const VectorOfElementsData & a);
VectorOfElements operator=(const VectorOfElements & a) const;
};
typedef shared_ptr<VectorOfElementsData> SPVectorOfElementsData;
typedef shared_ptr<VectorOfElements> SPVectorOfElements;
inline bool compatibleSizes (unsigned int s, const VectorOfElements & a);
acl::TypeID getElementType(const VectorOfElements & a, unsigned int i = 0);
unsigned int getElementsSize(const VectorOfElements & a);
//------------------------- Implementation -----------------
inline bool compatibleSizes(unsigned int s, const VectorOfElements & a)
{
return a.checkSizesCompatibility(s);
}
} // namespace acl
#endif // ACLVECTORELEMENTSDEF_H
acl::VectorOfElementsData
The class represents several ElementData.
Definition: aclVectorOfElementsDef.h:57
acl::VectorOfElementsData::VectorOfElementsData
VectorOfElementsData(unsigned int n)
acl::VectorOfElementsData::resizeElements
void resizeElements(unsigned int n)
acl::VectorOfElementsData::VectorOfElementsData
VectorOfElementsData(unsigned int n, unsigned int s, T, CommandQueue queue)
acl::VectorOfElementsData::checkSizesCompatibility
bool checkSizesCompatibility(unsigned int n) const
checks whether all Elements have sizes compatible with n
acl::VectorOfElementsData::VectorOfElementsData
VectorOfElementsData(unsigned int n, unsigned int s, T)
acl::VectorOfElementsData::operator=
VectorOfElements operator=(const VectorOfElementsData &a) const
acl::VectorOfElementsData::operator=
VectorOfElements operator=(const VectorOfElements &a) const
acl::VectorOfElementsData::VectorOfElementsData
VectorOfElementsData()
acl::VectorOfElements
The class represents several Element.
Definition: aclVectorOfElementsDef.h:92
acl::VectorOfElements::VectorOfElements
VectorOfElements(unsigned int n)
acl::VectorOfElements::getElementType
acl::TypeID getElementType(const VectorOfElements &a, unsigned int i=0)
acl::VectorOfElements::VectorOfElements
VectorOfElements()
acl::VectorOfElements::operator=
VectorOfElements operator=(const VectorOfElements &a) const
acl::VectorOfElements::VectorOfElements
VectorOfElements(const VectorOfElementsData &a)
acl::VectorOfElements::checkSizesCompatibility
bool checkSizesCompatibility(unsigned int n) const
checks whether all Elements have sizes compatible with n
acl::VectorOfElements::getElementsSize
unsigned int getElementsSize(const VectorOfElements &a)
acl
Advanced Computational Language.
Definition: acl.h:41
acl::SPVectorOfElementsData
shared_ptr< VectorOfElementsData > SPVectorOfElementsData
Definition: aclVectorOfElementsDef.h:105
acl::CommandQueue
std::shared_ptr< cl::CommandQueue > CommandQueue
Definition: acl.h:51
acl::TypeID
TypeID
Definition: aclTypes.h:39
acl::compatibleSizes
bool compatibleSizes(unsigned int s, const VectorOfElements &a)
Definition: aclVectorOfElementsDef.h:118
acl::ElementData
std::shared_ptr< MemBlock > ElementData
Definition: acl.h:47
acl::SPVectorOfElements
shared_ptr< VectorOfElements > SPVectorOfElements
Definition: aclVectorOfElementsDef.h:106
acl::Element
std::shared_ptr< ElementBase > Element
Definition: acl.h:49
cl
The OpenCL C++ bindings are defined within this namespace.
Definition: acl.h:34