Changeset 12860


Ignore:
Timestamp:
08/01/12 17:08:52 (13 years ago)
Author:
Mathieu Morlighem
Message:

TriMesh matrices should be sequential by default

Location:
issm/trunk-jpl/src/c
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/classes/matrix/Matrix.cpp

    r12851 r12860  
    168168                this->smatrix->Assemble();
    169169        }
    170         else _error2_("Matrix type: " << type << " not supported yet!");
     170        else{
     171                _error2_("Matrix type: " << type << " not supported yet!");
     172        }
    171173}
    172174/*}}}*/
     
    302304/*}}}*/
    303305/*FUNCTION Matrix::Convert{{{*/
    304 void Matrix::Convert(MatrixType type){
    305 
    306         if((int)type==(int)PetscMatType){
    307                 #ifdef _HAVE_PETSC_
    308                 this->pmatrix->Convert(type);
    309                 #else
    310                 _error2_("Petsc matrix format not usable, as Petsc has not been compiled!");
    311                 #endif
    312         }
    313         else if((int)type==(int)SeqMatType){
    314                 this->smatrix->Convert(type);
    315         }
    316         else _error2_("Matrix type: " << type << " not supported yet!");
    317 
    318 }
    319 /*}}}*/
     306void Matrix::Convert(MatrixType newtype){
     307
     308        if(type==PetscMatType){
     309                #ifdef _HAVE_PETSC_
     310                this->pmatrix->Convert(newtype);
     311                #else
     312                _error2_("Petsc matrix format not usable, as Petsc has not been compiled!");
     313                #endif
     314        }
     315        else if(type==SeqMatType){
     316                this->smatrix->Convert(newtype);
     317        }
     318        else{
     319                _error2_("Matrix type: " << type << " not supported yet!");
     320        }
     321
     322}
     323/*}}}*/
  • issm/trunk-jpl/src/c/classes/matrix/Matrix.h

    r12850 r12860  
    1616#include "../../toolkits/toolkits.h"
    1717#include "../../EnumDefinitions/EnumDefinitions.h"
    18 
     18/*}}}*/
    1919class Vector;
    20 /*}}}*/
    21 
    22 enum matrixtype { PetscMatType, SeqMatType };
     20enum matrixtype{PetscMatType, SeqMatType};
    2321
    2422class Matrix{
     
    2725
    2826                #ifdef _HAVE_PETSC_
    29                 PetscMat* pmatrix;
     27                PetscMat *pmatrix;
    3028                #endif
    31                 SeqMat* smatrix;
    32                 int     type;
     29                SeqMat   *smatrix;
     30                int       type;
    3331
    3432                /*Matrix constructors, destructors {{{*/
     
    4139                /*}}}*/
    4240                /*Matrix specific routines {{{*/
    43                 void Echo(void);
    44                 void Assemble(void);
    45                 IssmDouble Norm(NormMode norm_type);
    46                 void GetSize(int* pM,int* pN);
    47                 void GetLocalSize(int* pM,int* pN);
    48                 void MatMult(Vector* X,Vector* AX);
    49                 Matrix* Duplicate(void);
    50                 IssmDouble* ToSerial(void);
    51                 void SetValues(int m,int* idxm,int n,int* idxn,IssmDouble* values,InsMode mode);
    52                 void Convert(MatrixType type);
     41                void        Echo(void);
     42                void        Assemble(void);
     43                IssmDouble  Norm(NormMode norm_type);
     44                void        GetSize(int *pM,int*pN);
     45                void        GetLocalSize(int *pM,int*pN);
     46                void        MatMult(Vector *X,Vector*AX);
     47                Matrix     *Duplicate(void);
     48                IssmDouble *ToSerial(void);
     49                void        SetValues(int m,int *idxm,int n,int*idxn,IssmDouble*values,InsMode mode);
     50                void        Convert(MatrixType newtype);
    5351                /*}}}*/
    54 
    5552};
    5653
  • issm/trunk-jpl/src/c/modules/TriMeshx/TriMeshx.cpp

    r12450 r12860  
    192192
    193193        /*Output : */
    194         index_matrix=new Matrix(index,out.numberoftriangles,3,1);
    195         index_matrix->Convert(DENSE_SEQUENTIAL);
     194        index_matrix=new Matrix(index,out.numberoftriangles,3,1,SeqMatType);
    196195        *pindex=index_matrix;
    197196       
    198         segments_matrix=new Matrix(segments,out.numberofsegments,3,1); segments_matrix->Convert(DENSE_SEQUENTIAL);
     197        segments_matrix=new Matrix(segments,out.numberofsegments,3,1,SeqMatType);
    199198        *psegments=segments_matrix;
    200199
    201         *px=new Vector(x,out.numberofpoints);
    202         *py=new Vector(y,out.numberofpoints);
    203         *psegmentmarkerlist=new Vector(segmentmarkerlist,out.numberofsegments);
     200        *px=new Vector(x,out.numberofpoints,SeqMatType);
     201        *py=new Vector(y,out.numberofpoints,SeqMatType);
     202        *psegmentmarkerlist=new Vector(segmentmarkerlist,out.numberofsegments,SeqMatType);
    204203}
  • issm/trunk-jpl/src/c/toolkits/issm/SeqMat.cpp

    r12520 r12860  
    4545}
    4646/*}}}*/
    47 /*FUNCTION SeqMat(IssmDouble* serial_mat,int M,int N,IssmDouble sparsity){{{*/
     47/*FUNCTION SeqMat::SeqMat(IssmDouble* serial_mat,int M,int N,IssmDouble sparsity){{{*/
    4848SeqMat::SeqMat(IssmDouble* serial_mat,int pM,int pN,IssmDouble sparsity){
    4949
Note: See TracChangeset for help on using the changeset viewer.