28#ifndef _math_scmat_block_h
29#define _math_scmat_block_h
35#include <util/state/state.h>
45class SCMatrixBlock:
public SavableState {
51 virtual ~SCMatrixBlock();
63 virtual double *
dat();
64 virtual int ndat()
const;
69 virtual void process(
SCElementOp3*, SCMatrixBlock*, SCMatrixBlock*) = 0;
73class SCMatrixBlockListLink {
75 void operator = (
const SCMatrixBlockListLink&) {}
77 SCMatrixBlockListLink* _next;
79 SCMatrixBlockListLink(
SCMatrixBlock*, SCMatrixBlockListLink* = 0);
80 ~SCMatrixBlockListLink();
82 void next(SCMatrixBlockListLink* link) { _next = link; }
84 SCMatrixBlockListLink* next() {
return _next; }
87class SCMatrixBlockListIter {
91 SCMatrixBlockListIter(): link(0) {}
93 int operator !=(
const SCMatrixBlockListIter p)
const {
94 return link != p.link;
96 void operator ++() { link = link->next(); }
97 void operator ++(
int) { link = link->next(); }
101class SCMatrixBlockList:
public SavableState {
107 ~SCMatrixBlockList();
113 SCMatrixBlockList *deepcopy();
127class SCVectorSimpleBlock:
public SCMatrixBlock {
129 SCVectorSimpleBlock(
int istart,
int iend);
131 virtual ~SCVectorSimpleBlock();
141 void process(
SCElementOp3*, SCMatrixBlock*, SCMatrixBlock*);
158class SCVectorSimpleSubBlock:
public SCMatrixBlock {
160 SCVectorSimpleSubBlock(
int istart,
int iend,
int offset,
double* data);
161 SCVectorSimpleSubBlock(
StateIn&);
162 virtual ~SCVectorSimpleSubBlock();
171 void process(
SCElementOp3*, SCMatrixBlock*, SCMatrixBlock*);
187class SCMatrixRectBlock:
public SCMatrixBlock {
189 SCMatrixRectBlock(
int is,
int ie,
int js,
int je);
191 virtual ~SCMatrixRectBlock();
203 void process(
SCElementOp3*, SCMatrixBlock*, SCMatrixBlock*);
223class SCMatrixRectSubBlock:
public SCMatrixBlock {
225 SCMatrixRectSubBlock(
int is,
int ie,
int istride,
int js,
int je,
227 SCMatrixRectSubBlock(
StateIn&);
229 virtual ~SCMatrixRectSubBlock();
241 void process(
SCElementOp3*, SCMatrixBlock*, SCMatrixBlock*);
257class SCMatrixLTriBlock:
public SCMatrixBlock {
259 SCMatrixLTriBlock(
int s,
int e);
261 virtual ~SCMatrixLTriBlock();
271 void process(
SCElementOp3*, SCMatrixBlock*, SCMatrixBlock*);
292class SCMatrixLTriSubBlock:
public SCMatrixBlock {
294 SCMatrixLTriSubBlock(
int is,
int ie,
int js,
int je,
double*data);
295 SCMatrixLTriSubBlock(
StateIn&);
297 virtual ~SCMatrixLTriSubBlock();
308 void process(
SCElementOp3*, SCMatrixBlock*, SCMatrixBlock*);
322class SCMatrixDiagBlock:
public SCMatrixBlock {
324 SCMatrixDiagBlock(
int istart,
int iend,
int jstart);
325 SCMatrixDiagBlock(
int istart,
int iend);
327 virtual ~SCMatrixDiagBlock();
338 void process(
SCElementOp3*, SCMatrixBlock*, SCMatrixBlock*);
355class SCMatrixDiagSubBlock:
public SCMatrixBlock {
357 SCMatrixDiagSubBlock(
int istart,
int iend,
int jstart,
int offset,
359 SCMatrixDiagSubBlock(
int istart,
int iend,
int offset,
double*data);
360 SCMatrixDiagSubBlock(
StateIn&);
362 virtual ~SCMatrixDiagSubBlock();
373 void process(
SCElementOp3*, SCMatrixBlock*, SCMatrixBlock*);
385 enum Access { Read, Write, Accum, None };
402 Access
access()
const {
return access_; }
432 SCMatrixNullSubblockIter();
433 SCMatrixNullSubblockIter(Access);
446 SCMatrixCompositeSubblockIter(Access,
int niter);
449 ~SCMatrixCompositeSubblockIter();
455 int current_block()
const {
return iiter_; }
469 ~SCMatrixJointSubblockIter();
A template class that maintains references counts.
Definition ref.h:332
The SCElementOp2 class is very similar to the SCElementOp class except that pairs of blocks are treat...
Definition elemop.h:125
The SCElementOp3 class is very similar to the SCElementOp class except that a triplet of blocks is tr...
Definition elemop.h:147
Objects of class SCElementOp are used to perform operations on the elements of matrices.
Definition elemop.h:60
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
SCMatrixBlock is the base clase for all types of blocks that comprise matrices and vectors.
Definition block.h:45
virtual double * dat()
Return a pointer to the block's data and the number of elements in the block.
virtual SCMatrixBlock * deepcopy() const
Return of copy of this.
void save_data_state(StateOut &s)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
int ready()
Returns nonzero if there is another block.
void next()
Proceed to the next block.
SCMatrixBlock * block()
Return the current block.
void begin()
Start at the beginning.
double * dat()
Return a pointer to the block's data and the number of elements in the block.
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
SCMatrixBlock * deepcopy() const
Return of copy of this.
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
void begin()
Start at the beginning.
void next()
Proceed to the next block.
int ready()
Returns nonzero if there is another block.
SCMatrixBlock * block()
Return the current block.
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
double * dat()
Return a pointer to the block's data and the number of elements in the block.
SCMatrixBlock * deepcopy() const
Return of copy of this.
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
int ready()
Returns nonzero if there is another block.
void begin()
Start at the beginning.
void next()
Proceed to the next block.
SCMatrixBlock * block()
Return the current block.
int ready()
Returns nonzero if there is another block.
SCMatrixBlock * block()
Return the current block.
void begin()
Start at the beginning.
void next()
Proceed to the next block.
double * dat()
Return a pointer to the block's data and the number of elements in the block.
SCMatrixBlock * deepcopy() const
Return of copy of this.
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
int ready()
Returns nonzero if there is another block.
void begin()
Start at the beginning.
SCMatrixBlock * block()
Return the current block.
void next()
Proceed to the next block.
Objects of class SCMatrixSubblockIter are used to iterate through the blocks of a matrix.
Definition block.h:383
Access access() const
Return the type of Access allowed for these blocks.
Definition block.h:402
virtual void next()=0
Proceed to the next block.
virtual SCMatrixBlock * block()=0
Return the current block.
virtual int ready()=0
Returns nonzero if there is another block.
virtual void begin()=0
Start at the beginning.
SCMatrixSubblockIter(Access access)
The access variable should be one of Read, Write, Accum, and None, with the SCMatrixSubblockIter:: sc...
Definition block.h:391
SCMatrixBlock * deepcopy() const
Return of copy of this.
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
double * dat()
Return a pointer to the block's data and the number of elements in the block.
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
Restores objects that derive from SavableState.
Definition statein.h:70
Serializes objects that derive from SavableState.
Definition stateout.h:61