52 #ifndef DynCompCol_USE_STL_SETS 63 #ifndef DynCompCol_USE_STL_SETS 80 #ifndef DynCompCol_USE_STL_SETS 103 this->columns =
new std :: map< int, double > * [ S.
nColumns ];
104 for ( i = 0; i < S.
nColumns; i++ ) {
105 this->columns [ i ] =
new std :: map< int, double >(*S.columns [ i ]);
108 this->columns = NULL;
122 #ifndef DynCompCol_USE_STL_SETS 144 if ( this->columns ) {
146 delete this->columns [ i ];
149 delete this->columns;
165 #ifndef DynCompCol_USE_STL_SETS 178 for ( i = 0; i < C.
nColumns; i++ ) {
196 for ( i = 0; i < C.
nColumns; i++ ) {
206 if ( this->columns ) {
208 this->columns [ i ] = C.columns [ i ];
237 #ifndef DynCompCol_USE_STL_SETS 251 for (
int j = 0; j <
nColumns; j++ ) {
253 for (
auto &val: columns [ j ] ) {
254 answer(val.first) += val.second * rhs;
263 #ifndef DynCompCol_USE_STL_SETS 264 for (
int j = 0; j <
nColumns; j++ ) {
269 for (
int j = 0; j <
nColumns; j++ ) {
270 for (
auto &val: columns [ j ] ) {
285 #ifndef DynCompCol_USE_STL_SETS 292 for (
int i = 0; i <
nColumns; i++ ) {
300 for (
int j = 0; j < neq; j++ ) {
306 for (
int i = 0; i <
nColumns; i++ ) {
314 for (
int j = 0; j < neq; j++ ) {
319 elem->giveLocationArray(loc, s);
321 for (
int ii : loc ) {
323 for (
int jj : loc ) {
333 std :: vector< IntArray >r_locs;
334 std :: vector< IntArray >c_locs;
336 for (
auto &gbc : domain->
giveBcs() ) {
340 for ( std :: size_t k = 0; k < r_locs.size(); k++ ) {
343 for (
int ii : krloc ) {
345 for (
int jj : kcloc ) {
357 for (
int j = 0; j < neq; j++ ) {
361 OOFEM_LOG_DEBUG(
"DynCompCol info: neq is %d, nelem is %d\n", neq, nz_);
365 columns.resize( neq );
366 for (
auto &col: columns ) {
381 int i, j, ii, jj, dim;
386 OOFEM_ERROR(
"dimension of 'k' and 'loc' mismatch");
393 for ( j = 1; j <= dim; j++ ) {
396 for ( i = 1; i <= dim; i++ ) {
399 this->
at(ii, jj) += mat.
at(i, j);
413 #ifndef DynCompCol_USE_STL_SETS 434 int i, ii, ii1, j, jj, jj1, rowindx;
446 for ( i = 0; i < csize; i++ ) {
447 if ( ( ii = cloc(i) ) ) {
449 for ( j = 0; j < rsize; j++ ) {
450 if ( ( jj = rloc(j) ) ) {
480 int i, ii, ii1, j, jj, jj1;
484 for ( i = 0; i < csize; i++ ) {
485 if ( ( ii = cloc(i) ) ) {
487 for ( j = 0; j < rsize; j++ ) {
488 if ( ( jj = rloc(j) ) ) {
490 this->columns [ ii1 ] [ jj1 ] += mat(j, i);
505 #ifndef DynCompCol_USE_STL_SETS 506 for (
int j = 0; j <
nColumns; j++ ) {
511 for (
auto &col: columns ) {
512 for (
auto &val: col ) {
525 #ifndef DynCompCol_USE_STL_SETS 532 nz_ += columns [ j ].size();
534 OOFEM_LOG_DEBUG(
"DynCompCol info: neq is %d, nelem is %d\n", nColumns, nz_);
546 #ifndef DynCompCol_USE_STL_SETS 555 if ( ( rowIndx = this->
giveRowIndx(j - 1, i - 1) ) ) {
559 OOFEM_ERROR(
"Array accessing exception -- (%d,%d) out of bounds", i, j);
563 return this->columns [ j - 1 ] [ i - 1 ];
571 #ifndef DynCompCol_USE_STL_SETS 584 if ( ( rowIndx = this->
giveRowIndx(j - 1, i - 1) ) ) {
588 if ( i <=
nRows && j <= nColumns ) {
591 OOFEM_ERROR(
"Array accessing exception -- (%d,%d) out of bounds", i, j);
596 auto pos = this->columns [ j - 1 ].find(i - 1);
597 if ( pos != this->columns [ j - 1 ].end() ) {
600 OOFEM_ERROR(
"Array accessing exception -- (%d,%d) out of bounds", i, j);
609 #ifndef DynCompCol_USE_STL_SETS 626 if ( i <
nRows && j < nColumns ) {
629 OOFEM_ERROR(
"Array accessing exception -- (%d,%d) out of bounds", i, j);
634 auto pos = this->columns [ j ].find(i);
635 if ( pos != this->columns [ j ].end() ) {
638 OOFEM_ERROR(
"Array accessing exception -- (%d,%d) out of bounds", i, j);
649 #ifndef DynCompCol_USE_STL_SETS 664 OOFEM_ERROR(
"Array element (%d,%d) not in sparse structure -- cannot assign", i, j);
668 return this->columns [ j ] [ i ];
678 OOFEM_ERROR(
"Error in CompCol -- incompatible dimensions");
683 #ifndef DynCompCol_USE_STL_SETS 698 for (
int i = 0; i <
nColumns; i++ ) {
700 for (
auto &val: columns [ i ] ) {
701 r += val.second * x(val.first);
717 for ( i = 0; i < size; i++ ) {
718 maxid =
max( maxid, loc(i) );
723 #ifndef DynCompCol_USE_STL_SETS 726 for ( i = 0; i < size; i++ ) {
727 if ( ( ii = loc(i) ) ) {
728 for ( j = 0; j < size; j++ ) {
729 if ( ( jj = loc(j) ) ) {
747 for ( i = 0; i < rsize; i++ ) {
748 maxid =
max( maxid, rloc(i) );
751 for ( i = 0; i < csize; i++ ) {
752 maxid =
max( maxid, cloc(i) );
757 #ifndef DynCompCol_USE_STL_SETS 761 for ( i = 0; i < csize; i++ ) {
762 if ( ( ii = cloc(i) ) ) {
763 for ( j = 0; j < rsize; j++ ) {
764 if ( ( jj = rloc(j) ) ) {
778 if ( ns > nColumns ) {
779 #ifndef DynCompCol_USE_STL_SETS 784 for (
int i = 0; i <
nColumns; i++ ) {
786 newrowind_ [ i ] =
rowind_ [ i ];
798 nColumns =
nRows = ns;
803 #ifndef DynCompCol_USE_STL_SETS 808 int middle = ( left + right ) / 2;
815 if ( this->
rowind_ [ col ]->
at(right) == row ) {
819 while ( !( ( ( middleVal = this->
rowind_ [ col ]->
at(middle) ) == row ) || ( middle == left ) ) ) {
820 if ( row > middleVal ) {
826 middle = ( left + right ) / 2;
829 if ( middleVal == row ) {
843 int left = 1, right = oldsize;
844 int middle = ( left + right ) / 2;
847 if ( oldsize == 0 ) {
855 if ( this->
rowind_ [ col ]->
at(right) == row ) {
859 while ( !( ( ( middleVal = this->
rowind_ [ col ]->
at(middle) ) == row ) || ( middle == left ) ) ) {
860 if ( row > middleVal ) {
866 middle = ( left + right ) / 2;
869 if ( middleVal == row ) {
874 if ( row > this->
rowind_ [ col ]->
at(oldsize) ) {
876 }
else if ( row < this->
rowind_ [ col ]->
at(1) ) {
884 for ( i = oldsize; i >= right; i-- ) {
int nColumns
Number of columns.
virtual int giveNumberOfDomainEquations(int di, const UnknownNumberingScheme &num)
Returns number of equations for given domain in active (current time step) time step.
Dynamically growing compressed column.
Base class for all matrices stored in sparse format.
double & at(int i)
Coefficient access function.
int max(int i, int j)
Returns bigger value form two given decimals.
double operator()(int i, int j) const
Implements 0-based access.
void checkSizeTowards(IntArray &)
SparseMtrx * GiveCopy() const
Returns a newly allocated copy of receiver.
virtual int assemble(const IntArray &loc, const FloatMatrix &mat)
Assembles sparse matrix from contribution of local elements.
#define OOFEM_LOG_DEBUG(...)
Class implementing an array of integers.
int & at(int i)
Coefficient access function.
virtual double & at(int i, int j)
Returns coefficient at position (i,j).
virtual void timesT(const FloatArray &x, FloatArray &answer) const
Evaluates .
Implementation of sparse matrix stored in compressed column storage.
virtual void printStatistics() const
Prints the receiver statistics (one-line) to stdout.
std::vector< std::unique_ptr< GeneralBoundaryCondition > > & giveBcs()
REGISTER_SparseMtrx(CompCol, SMT_CompCol)
Abstract base class allowing to control the way, how equations are assigned to individual DOFs...
virtual void zero()
Zeroes the receiver.
void resizeWithValues(int n, int allocChunk=0)
Checks size of receiver towards requested bounds.
int giveRowIndx(int col, int row) const
Returns the row index of given row at given column, else returns zero.
Abstract base class for all active boundary conditions.
void resizeWithValues(int s, int allocChunk=0)
Checks size of receiver towards requested bounds.
virtual ~DynCompCol()
Destructor.
double at(int i, int j) const
Coefficient access function.
void resize(int n)
Checks size of receiver towards requested bounds.
DynCompCol & operator=(const DynCompCol &C)
Assignment operator.
int insertRowInColumn(int col, int row)
Insert row entry into column, preserving order of row indexes, returns the index of new row...
SparseMtrxVersionType version
Allows to track if receiver changes.
virtual int buildInternalStructure(EngngModel *, int, const UnknownNumberingScheme &)
Builds internal structure of receiver.
Class representing vector of real numbers.
Implementation of matrix containing floating point numbers.
void zero()
Zeroes all coefficients of receiver.
void times(double s)
Multiplies receiver with scalar.
std::vector< std::unique_ptr< Element > > & giveElements()
virtual void times(const FloatArray &x, FloatArray &answer) const
Evaluates .
Abstract base class representing the "problem" under consideration.
int giveSize() const
Returns the size of receiver.
the oofem namespace is to define a context or scope in which all oofem names are defined.
Domain * giveDomain(int n)
Service for accessing particular problem domain.
int giveNumberOfRows() const
Returns number of rows of receiver.
virtual void giveLocationArrays(std::vector< IntArray > &rows, std::vector< IntArray > &cols, CharType type, const UnknownNumberingScheme &r_s, const UnknownNumberingScheme &c_s)
Gives a list of location arrays that will be assembled.
void resize(int s)
Resizes receiver towards requested size.