]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
MEDMEM Industrialization 2008
authoreap <eap@opencascade.com>
Wed, 17 Dec 2008 17:49:32 +0000 (17:49 +0000)
committereap <eap@opencascade.com>
Wed, 17 Dec 2008 17:49:32 +0000 (17:49 +0000)
   fix ParaFIELD::ParaFIELD(MEDMEM::FIELD<double>* subdomain_field, const ProcessorGroup& proc_group)

src/ParaMEDMEM/ParaFIELD.cxx

index 6f38cc4336ff311eea31369b0c0ad2cd27b325a6..30a533fe61e4f864399f5a6c9bba80f3206418a6 100644 (file)
@@ -1,3 +1,21 @@
+//  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"
@@ -131,7 +149,13 @@ _has_support_ownership(true)
 {
   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, 
@@ -211,12 +235,13 @@ double ParaFIELD::getVolumeIntegral(int icomp) const
 {
        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);