30 #ifndef PTRARRAYBASE_H 31 #define PTRARRAYBASE_H 33 #include "xc_utils/src/kernel/CommandEntity.h" 34 #include "xc_basic/src/matrices/TMatrix.h" 36 #include "boost/any.hpp" 37 #include "boost/lexical_cast.hpp" 40 #include "xc_basic/src/matrices/m_int.h" 49 class PtrArrayBase:
public TMatrix<T *,std::vector<T *> >,
public CommandEntity
52 typedef TMatrix<T *,std::vector<T *> > m_ptr;
53 typedef typename m_ptr::iterator iterator;
54 typedef typename m_ptr::const_iterator const_iterator;
55 typedef typename m_ptr::value_type value_type;
56 typedef typename m_ptr::reference reference;
57 typedef typename m_ptr::const_reference const_reference;
63 : m_ptr(f,c,nullptr), CommandEntity() {}
65 bool Null(
void)
const;
68 void dim(
const size_t &,
const size_t &);
75 std::vector<int> getTagsObjs(
void);
81 { this->resize(nRows,numberOfColumns,
nullptr); }
90 return (this->
operator()(1,1)==
nullptr);
102 const size_t numberOfRows= this->getNumberOfRows();
103 const size_t numberOfColumns= this->getNumberOfColumns();
104 for(
size_t j= 1;j<=numberOfRows;j++)
105 for(
size_t k= 1;k<=numberOfColumns;k++)
106 if(this->
operator()(j,k)==
nullptr)
120 const std::string nmbBlq= getClassName()+
":row_objects:"+boost::lexical_cast<std::string>(f);
121 const size_t numCols= this->getNumberOfColumns();
122 std::vector<int> retval(numCols);
123 for(
size_t i= 1;i<=numCols;i++)
124 retval[i-1]= (*
this)(f,i)->getTag();
133 const std::string nmbBlq= getClassName()+
":column_objects:"+boost::lexical_cast<std::string>(c);
134 const size_t n_rows= this->getNumberOfRows();
135 std::vector<int> retval(n_rows);
136 for(
size_t i= 1;i<=n_rows;i++)
137 retval[i-1]= (*
this)(i,c)->getTag();
146 const std::string nmbBlq= getClassName()+
":row_interior_objects:"+boost::lexical_cast<std::string>(f);
147 const size_t numCols= this->getNumberOfColumns();
148 std::vector<int> retval(numCols-2);
149 for(
size_t i= 2;i<numCols;i++)
150 retval[i-2]= (*
this)(f,i)->getTag();
159 const std::string nmbBlq= getClassName()+
":column_interior_objects:"+boost::lexical_cast<std::string>(c);
160 const size_t n_rows= this->getNumberOfRows();
161 std::vector<int> retval(n_rows-2);
162 for(
size_t i= 2;i<n_rows;i++)
163 retval[i-2]= (*
this)(i,c)->getTag();
172 const size_t n_rows= this->getNumberOfRows();
173 const size_t numCols= this->getNumberOfColumns();
174 std::vector<int> retval((n_rows-1)*(numCols-1));
181 m_int tmp(n_rows-2,numCols-2);
182 for(
size_t i= 2;i<n_rows;i++)
183 for(
size_t j= 2;j<numCols;j++)
184 tmp(i-1,j-1)= (*this)(i,j)->getTag();
185 retval= tmp.getVector();
193 const size_t n_rows= this->getNumberOfRows();
194 const size_t numCols= this->getNumberOfColumns();
195 std::vector<int> retval(n_rows*numCols);
196 m_int tmp(n_rows,numCols);
197 for(
size_t i= 1;i<=n_rows;i++)
198 for(
size_t j= 1;j<=numCols;j++)
199 tmp(i,j)= (*this)(i,j)->getTag();
200 retval= tmp.getVector();
bool HasNull(void) const
Returns true if it's empty or any of the pointers are NULL.
Definition: PtrArrayBase.h:95
std::vector< int > getColumnObjectsTags(const size_t &)
Asks each of the objects in the column to execute the code being passed as parameter.
Definition: PtrArrayBase.h:131
std::vector< int > getRowInteriorObjectsTags(const size_t &)
Asks each of the objects at the interior of the row to execute the code being passed as parameter...
Definition: PtrArrayBase.h:144
PtrArrayBase(const size_t &f=0, const size_t &c=0)
Constructor.
Definition: PtrArrayBase.h:62
bool Null(void) const
Returns true if it's empty or the pointers are NULL.
Definition: PtrArrayBase.h:85
std::vector< int > getRowObjectsTags(const size_t &)
Asks each of the objects in the row to execute the code being passed as parameter.
Definition: PtrArrayBase.h:118
void dim(const size_t &, const size_t &)
Matrix dimensions.
Definition: PtrArrayBase.h:80
std::vector< int > getColumnInteriorObjectsTags(const size_t &)
Asks each of the objects at the interior of the column to execute the code being passed as parameter...
Definition: PtrArrayBase.h:157
std::vector< int > getTagsInteriorObjs(void)
Asks each of the objects at the interior to execute the code being passed as parameter.
Definition: PtrArrayBase.h:170
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:34
Base class for matrices of pointers to nodes, elements and points.
Definition: PtrArrayBase.h:49