/** * @file aka_static_memory_tmpl.hh * * @author Nicolas Richart * * @date creation: Thu Jul 15 2010 * @date last modification: Sun Oct 19 2014 * * @brief template part of the StaticMemory * * @section LICENSE * * Copyright (©) 2010-2012, 2014, 2015 EPFL (Ecole Polytechnique Fédérale de * Lausanne) Laboratory (LSMS - Laboratoire de Simulation en Mécanique des * Solides) * * Akantu 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 3 of the License, or (at your option) any * later version. * * Akantu 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 Akantu. If not, see . * */ /* -------------------------------------------------------------------------- */ template Array & StaticMemory::smalloc(const MemoryID & memory_id, const ID & name, UInt size, UInt nb_component) { AKANTU_DEBUG_IN(); MemoryMap::iterator memory_it; memory_it = memories.find(memory_id); if(memory_it == memories.end()){ memories[memory_id] = ArrayMap(); memory_it = memories.find(memory_id); } if((memory_it->second).find(name) != (memory_it->second).end()) { AKANTU_DEBUG_ERROR("The vector \"" << name << "\" is already registred in the memory " << memory_id); } Array * tmp_vect = new Array(size, nb_component, name); (memory_it->second)[name] = tmp_vect; AKANTU_DEBUG_OUT(); return *tmp_vect; } /* -------------------------------------------------------------------------- */ template Array & StaticMemory::smalloc(const MemoryID & memory_id, const ID & name, UInt size, UInt nb_component, const T & init_value) { AKANTU_DEBUG_IN(); MemoryMap::iterator memory_it; memory_it = memories.find(memory_id); if(memory_it == memories.end()){ memories[memory_id] = ArrayMap(); memory_it = memories.find(memory_id); } if((memory_it->second).find(name) != (memory_it->second).end()) { AKANTU_DEBUG_ERROR("The vector \"" << name << "\" is already registred in the memory " << memory_id); } Array * tmp_vect = new Array(size, nb_component, init_value, name); (memory_it->second)[name] = tmp_vect; AKANTU_DEBUG_OUT(); return *tmp_vect; } /* -------------------------------------------------------------------------- */