Xyce  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
N_DEV_DeviceMaster.C
Go to the documentation of this file.
1 // Copyright Notice
2 //
3 // Copyright 2002 Sandia Corporation. Under the terms
4 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S.
5 // Government retains certain rights in this software.
6 //
7 // Xyce(TM) Parallel Electrical Simulator
8 // Copyright (C) 2002-2014 Sandia Corporation
9 //
10 // This program is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // This program is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with this program. If not, see <http://www.gnu.org/licenses/>.
22 //-----------------------------------------------------------------------------
23 
24 //-------------------------------------------------------------------------
25 // Filename : $RCSfile: N_DEV_DeviceMaster.C,v $
26 //
27 // Purpose : Provides templated versions of some boilerplate functions
28 // that are device-specific (so they can't easily be included
29 // in the base device, instance, or model classes).
30 //
31 // Special Notes : Much of the functionality of the device classes, like
32 // N_DEV_Capacitor, is simply to manage STL containers
33 // of model and instance pointers. That management is pretty
34 // generic, so templating that functionality makes sense.
35 //
36 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
37 //
38 // Creation Date : 01/31/06
39 //
40 // Revision Information:
41 // ---------------------
42 //
43 // Revision Number: $Revision: 1.2.2.1 $
44 //
45 // Revision Date : $Date: 2014/03/03 18:29:27 $
46 //
47 // Current Owner : $Author: tvrusso $
48 //-------------------------------------------------------------------------
49 
50 #include <Xyce_config.h>
51 
52 #include <N_DEV_DeviceMaster.h>
53 #include <N_DEV_Message.h>
54 #include <N_DEV_DeviceModel.h>
55 #include <N_DEV_DeviceInstance.h>
56 
57 namespace Xyce {
58 namespace Device {
59 
60 /**
61  * duplicate_entity_warning reports a duplication of entity names.
62  *
63  * Currently models and devices can share a name and the current implementation of entityMap_ results in lost
64  * information.
65  *
66  * @param entity const reference to the entity that is being added
67  *
68  * @author David G. Baur Raytheon Sandia National Laboratories 1355
69  * @date Tue Feb 4 10:12:14 2014
70  */
72 {
73 // DevelFatal(entity).in("DeviceMaster::addEntity") << "Attempt to add duplicate entity";
74  UserWarning(entity) << "Duplicate entity, model and device share the name " << entity.getName();
75 }
76 
77 /**
78  * instance_must_reference_model_error reports that the type of instance requires that a model be specified
79  *
80  * @param device const reference to the device
81  * @param model_name const reference to the model name
82  * @param netlist_path const reference to the netlist path
83  * @param line_number line number in the netlist path
84  *
85  * @author David G. Baur Raytheon Sandia National Laboratories 1355
86  * @date Tue Feb 4 10:16:23 2014
87  */
88 void instance_must_reference_model_error(const Device &device, const std::string &model_name, const std::string &netlist_path, int line_number)
89 {
90  UserError(device).at(netlist_path, line_number) << model_name << " instance must reference a model";
91 }
92 
93 /**
94  * could_not_find_model reports that the model name is note defined
95  *
96  * @param device const reference to the device
97  * @param model_name const reference to the model name
98  * @param instance_name const reference to the instance name
99  * @param netlist_path const reference to the netlist path
100  * @param line_number line number in the netlist path
101  *
102  * @author David G. Baur Raytheon Sandia National Laboratories 1355
103  * @date Tue Feb 4 10:18:05 2014
104  */
105 void could_not_find_model(const Device &device, const std::string &model_name, const std::string &instance_name, const std::string &netlist_path, int line_number)
106 {
107  UserError(device).at(netlist_path, line_number) << "Could not find model " << model_name << " which is referenced by instance " << instance_name;
108 }
109 
110 /**
111  * duplicate_model_warning reports that the model name is duplicated.
112  *
113  *
114  * @param device const reference to the device
115  * @param model_name const reference to the model name
116  * @param netlist_path const reference to the netlist path
117  * @param line_number line number in the netlist path
118  *
119  * @author David G. Baur Raytheon Sandia National Laboratories 1355
120  * @date Tue Feb 4 10:18:41 2014
121  */
122 void duplicate_model_warning(const Device &device, const std::string &model_name, const std::string &netlist_path, int line_number)
123 {
124  UserWarning(device).at(netlist_path, line_number) << "Attempted to add model " << model_name << " that already exists, ignoring all but the first definition";
125 }
126 
127 } // namespace Device
128 } // namespace Xyce