+// Copyright (C) 2007-2008 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
#include "MEDMEM_Exception.hxx"
#include "Topology.hxx"
#include "BlockTopology.hxx"
{
const ExplicitTopology* source_topo=
dynamic_cast<const ExplicitTopology*> (_support->getTopology());
+ if ( source_topo )
_topology=new ExplicitTopology(*source_topo,_component_topology.nbLocalComponents());
+ else {
+ const BlockTopology* source_topo
+ = dynamic_cast<const BlockTopology*>(_support->getTopology());
+ _topology=new BlockTopology (*source_topo,_component_topology.nbLocalComponents());
+ }
}
ParaFIELD::ParaFIELD(MEDMEM::driverTypes driver_type, const string& file_name,
{
CommInterface comm_interface = _topology->getProcGroup()->getCommInterface();
const MEDMEM::SUPPORT* support = _field->getSupport();
- FIELD<double>* volume= getSupportVolumes(*support);
double integral=0.0;
- for (int i=0; i<support->getNumberOfElements(MED_EN::MED_ALL_ELEMENTS); i++)
- integral+=_field->getValueIJ(i+1,icomp)*volume->getValueIJ(i+1,1);
- delete volume;
-
+ if ( support->getEntity() != MED_EN::MED_NODE ) {
+ FIELD<double>* volume= getSupportVolumes(*support);
+ for (int i=0; i<support->getNumberOfElements(MED_EN::MED_ALL_ELEMENTS); i++)
+ integral+=_field->getValueIJ(i+1,icomp)*volume->getValueIJ(i+1,1);
+ delete volume;
+ }
double total=0.0;
const MPI_Comm* comm = (dynamic_cast<const MPIProcessorGroup*>(_topology->getProcGroup()))->getComm();
comm_interface.allReduce(&integral, &total, 1, MPI_DOUBLE, MPI_SUM, *comm);