On Thu, 24 Jun 2010, Jed Brown wrote: > On Thu, 24 Jun 2010 15:59:22 +0200 (CEST), Tim Kroeger > <tim.kroe...@cevis.uni-bremen.de> wrote: > >> In my application, I am doing quite a lot of assignments between >> NumericVector instances (which always are PetscVector instances in my >> case), and since I am lazily most of the time working in opt mode, I >> didn't realize that I was sometimes assigning vectors of different >> type, that is in particular >> >> v = w >> >> where v is a parallel vector and w is a ghosted vector. > > This is value-assignment, right?
Right. > There is no behavioral difference between a "parallel vector" and a > "ghosted vector" except that you can only VecGhostGetLocalForm and > VecGhostUpdate the latter. You can certainly VecCopy between them. Thanks for the update. > Whether your operator= should support these mismatched types is entirely > up to you. I suspect there are only two reasons why we didn't support mismatched types: when that assertion was written we only had serial and parallel vectors, a more extreme mismatch we didn't know for sure that you could VecCopy between mismatched types. These reasons no longer apply. > I could imagine imposing an artificial restriction just to > maintain consistent types so that you don't accidentally end up calling > VecGhostGetLocalForm on an plain vector (with work to figure out why > it's a plain vector and not VecGhost). As long as we don't copy the type over with operator=, this shouldn't be a concern for PetscVector. I'd say that we should at least enable "parallelvec = ghostedvec", if everyone agrees. "parallelvec = serialvec" and "ghostedvec = serialvec" would also be natural to enable. I'd just as soon eventually support every operator= combo, but the "morelocaldatavec = lesslocaldatavec" type operations would require us to add some code in addition to the plain VecCopy before they'd have the semantics I'd want. --- Roy ------------------------------------------------------------------------------ ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo _______________________________________________ Libmesh-devel mailing list Libmesh-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libmesh-devel