From 77de750cedf60c3c14e92f0e464243a563c4f506 Mon Sep 17 00:00:00 2001 From: eap Date: Wed, 17 Dec 2008 17:49:32 +0000 Subject: [PATCH] MEDMEM Industrialization 2008 fix ParaFIELD::ParaFIELD(MEDMEM::FIELD* subdomain_field, const ProcessorGroup& proc_group) --- src/ParaMEDMEM/ParaFIELD.cxx | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/src/ParaMEDMEM/ParaFIELD.cxx b/src/ParaMEDMEM/ParaFIELD.cxx index 6f38cc433..30a533fe6 100644 --- a/src/ParaMEDMEM/ParaFIELD.cxx +++ b/src/ParaMEDMEM/ParaFIELD.cxx @@ -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 (_support->getTopology()); + if ( source_topo ) _topology=new ExplicitTopology(*source_topo,_component_topology.nbLocalComponents()); + else { + const BlockTopology* source_topo + = dynamic_cast(_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* volume= getSupportVolumes(*support); double integral=0.0; - for (int i=0; igetNumberOfElements(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* volume= getSupportVolumes(*support); + for (int i=0; igetNumberOfElements(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(_topology->getProcGroup()))->getComm(); comm_interface.allReduce(&integral, &total, 1, MPI_DOUBLE, MPI_SUM, *comm); -- 2.39.2