~ubuntu-branches/ubuntu/feisty/petsc/feisty

« back to all changes in this revision

Viewing changes to src/vec/utils/vscat.c

  • Committer: Bazaar Package Importer
  • Author(s): Adam C. Powell, IV
  • Date: 2005-03-24 09:46:23 UTC
  • mfrom: (2.1.2 hoary)
  • Revision ID: james.westby@ubuntu.com-20050324094623-dfcxn8bltjms2cqq
Tags: 2.2.0-4
* Update for new mpich >> 1.2.5.3-2.
* Fixed src/inline/axpy.h for complex and UNROLL (closes: #284023, #293011).
* Added -fno-strict-aliasing to compile flags (closes: #274009).
* Switched SLES stuff to KSP in petsc.m4 (closes: 267796).

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
*/
8
8
 
9
9
#include "src/vec/is/isimpl.h"
10
 
#include "src/vec/vecimpl.h"                     /*I "petscvec.h" I*/
 
10
#include "vecimpl.h"                     /*I "petscvec.h" I*/
11
11
 
12
12
/* Logging support */
13
 
int VEC_SCATTER_COOKIE;
 
13
int VEC_SCATTER_COOKIE = 0;
14
14
 
15
15
/*
16
16
     Checks if any indices are less than zero and generates an error
726
726
   Output Parameter:
727
727
.  newctx - location to store the new scatter context
728
728
 
729
 
   Options Database:
 
729
   Options Database Keys:
730
730
+  -vecscatter_merge     - Merges scatter send and receive (may offer better performance with some MPIs)
731
731
.  -vecscatter_ssend     - Uses MPI_Ssend_init() instead of MPI_Send_init() (may offer better performance with some MPIs)
732
732
.  -vecscatter_sendfirst - Posts sends before receives (may offer better performance with some MPIs)
1358
1358
  int ierr;
1359
1359
 
1360
1360
  PetscFunctionBegin;
1361
 
  PetscValidHeaderSpecific(y,VEC_COOKIE);
1362
 
  PetscValidHeaderSpecific(inctx,VEC_SCATTER_COOKIE);
 
1361
  PetscValidHeaderSpecific(y,VEC_COOKIE,2);
 
1362
  PetscValidHeaderSpecific(inctx,VEC_SCATTER_COOKIE,5);
1363
1363
 
1364
1364
  if (inctx->postrecvs) {
1365
1365
    ierr = (*inctx->postrecvs)(x,y,addv,mode,inctx);CHKERRQ(ierr);
1420
1420
#endif
1421
1421
 
1422
1422
  PetscFunctionBegin;
1423
 
  PetscValidHeaderSpecific(x,VEC_COOKIE); PetscValidHeaderSpecific(y,VEC_COOKIE);
1424
 
  PetscValidHeaderSpecific(inctx,VEC_SCATTER_COOKIE);
 
1423
  PetscValidHeaderSpecific(x,VEC_COOKIE,1);
 
1424
  PetscValidHeaderSpecific(y,VEC_COOKIE,2);
 
1425
  PetscValidHeaderSpecific(inctx,VEC_SCATTER_COOKIE,5);
1425
1426
  if (inctx->inuse) SETERRQ(PETSC_ERR_ARG_WRONGSTATE," Scatter ctx already in use");
1426
1427
#if defined(PETSC_USE_BOPT_g)
1427
1428
  /*
1434
1435
    ierr = VecGetLocalSize(x,&from_n);CHKERRQ(ierr);
1435
1436
    ierr = VecGetLocalSize(y,&to_n);CHKERRQ(ierr);
1436
1437
    if (mode & SCATTER_REVERSE) {
1437
 
      if (to_n != inctx->from_n) SETERRQ(PETSC_ERR_ARG_SIZ,"Vector wrong size for scatter");
1438
 
      if (from_n != inctx->to_n) SETERRQ(PETSC_ERR_ARG_SIZ,"Vector wrong size for scatter");
 
1438
      if (to_n != inctx->from_n) SETERRQ(PETSC_ERR_ARG_SIZ,"Vector wrong size for scatter (scatter reverse and vector to != ctx from size)");
 
1439
      if (from_n != inctx->to_n) SETERRQ(PETSC_ERR_ARG_SIZ,"Vector wrong size for scatter (scatter reverse and vector from != ctx to size)");
1439
1440
    } else {
1440
 
      if (to_n != inctx->to_n)     SETERRQ(PETSC_ERR_ARG_SIZ,"Vector wrong size for scatter");
1441
 
      if (from_n != inctx->from_n) SETERRQ(PETSC_ERR_ARG_SIZ,"Vector wrong size for scatter");
 
1441
      if (to_n != inctx->to_n)     SETERRQ(PETSC_ERR_ARG_SIZ,"Vector wrong size for scatter (scatter forward and vector to != ctx to size)");
 
1442
      if (from_n != inctx->from_n) SETERRQ(PETSC_ERR_ARG_SIZ,"Vector wrong size for scatter (scatter forward and vector from != ctx from size)");
1442
1443
    }
1443
1444
  }
1444
1445
#endif
1485
1486
  int ierr;
1486
1487
 
1487
1488
  PetscFunctionBegin;
1488
 
  PetscValidHeaderSpecific(x,VEC_COOKIE); PetscValidHeaderSpecific(y,VEC_COOKIE);
1489
 
  PetscValidHeaderSpecific(ctx,VEC_SCATTER_COOKIE);
 
1489
  PetscValidHeaderSpecific(x,VEC_COOKIE,1);
 
1490
  PetscValidHeaderSpecific(y,VEC_COOKIE,2);
 
1491
  PetscValidHeaderSpecific(ctx,VEC_SCATTER_COOKIE,5);
1490
1492
  ctx->inuse = PETSC_FALSE;
1491
1493
  if (!ctx->end) PetscFunctionReturn(0);
1492
1494
  if (!ctx->beginandendtogether) {
1517
1519
  int ierr;
1518
1520
 
1519
1521
  PetscFunctionBegin;
1520
 
  PetscValidHeaderSpecific(ctx,VEC_SCATTER_COOKIE);
 
1522
  PetscValidHeaderSpecific(ctx,VEC_SCATTER_COOKIE,1);
1521
1523
  if (--ctx->refct > 0) PetscFunctionReturn(0);
1522
1524
 
1523
1525
  /* if memory was published with AMS then destroy it */
1549
1551
  int ierr;
1550
1552
 
1551
1553
  PetscFunctionBegin;
1552
 
  PetscValidHeaderSpecific(sctx,VEC_SCATTER_COOKIE);
1553
 
  PetscValidPointer(ctx);
 
1554
  PetscValidHeaderSpecific(sctx,VEC_SCATTER_COOKIE,1);
 
1555
  PetscValidPointer(ctx,2);
1554
1556
  if (!sctx->copy) SETERRQ(PETSC_ERR_SUP,"Cannot copy this type");
1555
1557
  PetscHeaderCreate(*ctx,_p_VecScatter,int,VEC_SCATTER_COOKIE,0,"VecScatter",sctx->comm,VecScatterDestroy,VecScatterView);
1556
1558
  PetscLogObjectCreate(*ctx);
1582
1584
  int ierr;
1583
1585
 
1584
1586
  PetscFunctionBegin;
1585
 
  PetscValidHeaderSpecific(ctx,VEC_SCATTER_COOKIE);
 
1587
  PetscValidHeaderSpecific(ctx,VEC_SCATTER_COOKIE,1);
1586
1588
  if (!viewer) viewer = PETSC_VIEWER_STDOUT_(ctx->comm);
1587
 
  PetscValidHeaderSpecific(viewer,PETSC_VIEWER_COOKIE);
 
1589
  PetscValidHeaderSpecific(viewer,PETSC_VIEWER_COOKIE,2);
1588
1590
  if (!ctx->view) SETERRQ(PETSC_ERR_SUP,"Cannot view this type of scatter context yet");
1589
1591
 
1590
1592
  ierr = (*ctx->view)(ctx,viewer);CHKERRQ(ierr);
1622
1624
  int                    i;
1623
1625
 
1624
1626
  PetscFunctionBegin;
1625
 
  PetscValidHeaderSpecific(scat,VEC_SCATTER_COOKIE);
1626
 
  if (rto)   {PetscValidIntPointer(rto);}
1627
 
  if (rfrom) {PetscValidIntPointer(rfrom);}
 
1627
  PetscValidHeaderSpecific(scat,VEC_SCATTER_COOKIE,1);
 
1628
  if (rto)   {PetscValidIntPointer(rto,2);}
 
1629
  if (rfrom) {PetscValidIntPointer(rfrom,3);}
1628
1630
 
1629
1631
  from = (VecScatter_Seq_General *)scat->fromdata;
1630
1632
  mto  = (VecScatter_MPI_General *)scat->todata;