Changeset 27ccb470 in tol


Ignore:
Timestamp:
Mar 1, 2012, 10:01:43 AM (15 years ago)
Author:
Víctor de Buen <vdebuen@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
6e04f71
Parents:
7d4ba03
Message:

Fixes #1455

git-svn-id: ​https://www.tol-project.org/svn/tolp/trunk@4235 be4846ae-f051-483a-831f-b64e7d08527f

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tol/btol/matrix_type/matgra.cpp

    r7d4ba03 r27ccb470  
    32973297}
    32983298
     3299//--------------------------------------------------------------------
     3300DeclareContensClass(BDat, BDatTemporary, BDatAppendRows);
     3301DefExtOpr(1, BDatAppendRows,  "AppendRows", 2, 2, "Matrix Matrix",
     3302  "(Matrix matRef, Matrix newRows)",
     3303  I2("Modifies first matrix adding all the rows from second one."
     3304     "If both matrices have not the same number of columns then "
     3305     "does nothing and returns 0, else returns the total number of "
     3306     "rows.",
     3307     "Modifica la primera matriz añadiéndole todas las filas de la"
     3308     "segunda. En caso de éxito, devuelve el número total de filas,"
     3309     "pero si las dos matrices no tienen el mismo número de columnas "
     3310     "no hace nada y devuelve 0."),
     3311      BOperClassify::MatrixAlgebra_);
     3312//--------------------------------------------------------------------
     3313void BDatAppendRows::CalcContens()
     3314//--------------------------------------------------------------------
     3315{
     3316  BMat& M1 = Mat(Arg(1));
     3317  BMat& M2 = Mat(Arg(2));
     3318  int c1 = M1.Columns();
     3319  int c2 = M2.Columns();
     3320  int r1 = M1.Rows();
     3321  int r2 = M2.Rows();
     3322  if(c1!=c2) { contens_ = 0; }
     3323  else if(r2==0)  { contens_ = r1; }
     3324  else
     3325  {
     3326    int r = r1+r2;
     3327    int s1 = r1*c1*sizeof(BDat);
     3328    int s2 = r2*c2*sizeof(BDat);
     3329    M1.Alloc(r,c1);
     3330    BDat* addPnt = M1.GetData().GetBuffer()+(r1*c1);
     3331    const BDat* newPnt = M2.Data().Buffer();
     3332    memcpy(addPnt,newPnt,s2);
     3333    contens_ = r;
     3334  }
     3335
     3336}
    32993337
    33003338//--------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.