[petsc-users] using petsc functions in structs?

John-Michael Fischer fischej at umich.edu
Wed May 12 14:54:42 CDT 2010


Hi, I'm fighting this issue.

In the follow code which is macro for a struct divide I get three errors about casting PetscErrorCode types into the name of the struct.

This is the code
struct IMPACT_Moment Divide(struct IMPACT_Moment * M1, struct IMPACT_Moment * M3)
{  // does M1./M3 and returns M2
  PetscErrorCode ierr;
  struct IMPACT_Moment M2;
  M2.Nx = M1->Nx;
  M2.Ny = M1->Ny;
  M2.coords[0] = M1->coords[0];
  M2.coords[1] = M1->coords[1];

78:  ierr = VecCopy(M1->xaxis, M2.xaxis);CHKERRQ(ierr);
79:  ierr = VecCopy(M1->yaxis, M2.yaxis);CHKERRQ(ierr);

81:  ierr = MatCopy(M1->values, M2.values, DIFFERENT_NONZERO_PATTERN);CHKERRQ(ierr);
...... goes on


and these are the only three error messages I get

IMPACTA_Moments.h: In function ‘IMPACT_Moment Divide(IMPACT_Moment*, IMPACT_Moment*)’:
IMPACTA_Moments.h:78: error: conversion from ‘PetscErrorCode’ to non-scalar type ‘IMPACT_Moment’ requested
IMPACTA_Moments.h:79: error: conversion from ‘PetscErrorCode’ to non-scalar type ‘IMPACT_Moment’ requested
IMPACTA_Moments.h:81: error: conversion from ‘PetscErrorCode’ to non-scalar type ‘IMPACT_Moment’ requested


Any thoughts?

JM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20100512/bcfea83c/attachment.htm>


More information about the petsc-users mailing list