Chaste Release::3.1
AbstractUntemplatedParameterisedSystem.cpp
00001 /*
00002 
00003 Copyright (c) 2005-2012, University of Oxford.
00004 All rights reserved.
00005 
00006 University of Oxford means the Chancellor, Masters and Scholars of the
00007 University of Oxford, having an administrative office at Wellington
00008 Square, Oxford OX1 2JD, UK.
00009 
00010 This file is part of Chaste.
00011 
00012 Redistribution and use in source and binary forms, with or without
00013 modification, are permitted provided that the following conditions are met:
00014  * Redistributions of source code must retain the above copyright notice,
00015    this list of conditions and the following disclaimer.
00016  * Redistributions in binary form must reproduce the above copyright notice,
00017    this list of conditions and the following disclaimer in the documentation
00018    and/or other materials provided with the distribution.
00019  * Neither the name of the University of Oxford nor the names of its
00020    contributors may be used to endorse or promote products derived from this
00021    software without specific prior written permission.
00022 
00023 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00024 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00025 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00026 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
00027 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00028 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
00029 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00030 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00031 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
00032 OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00033 
00034 */
00035 
00036 #include "AbstractUntemplatedParameterisedSystem.hpp"
00037 
00038 
00039 #include "Exception.hpp"
00040 #include "VectorHelperFunctions.hpp"
00041 
00042 
00043 AbstractUntemplatedParameterisedSystem::AbstractUntemplatedParameterisedSystem(unsigned numberOfStateVariables)
00044     : mNumberOfStateVariables(numberOfStateVariables)
00045 {
00046 }
00047 
00048 AbstractUntemplatedParameterisedSystem::~AbstractUntemplatedParameterisedSystem()
00049 {
00050 }
00051 
00052 boost::shared_ptr<const AbstractOdeSystemInformation> AbstractUntemplatedParameterisedSystem::GetSystemInformation() const
00053 {
00054     assert(mpSystemInfo);
00055     return mpSystemInfo;
00056 }
00057 
00058 
00059 std::string AbstractUntemplatedParameterisedSystem::GetSystemName() const
00060 {
00061     return GetSystemInformation()->GetSystemName();
00062 }
00063 
00064 //
00065 // State variable methods
00066 //
00067 
00068 unsigned AbstractUntemplatedParameterisedSystem::GetNumberOfStateVariables() const
00069 {
00070     return mNumberOfStateVariables;
00071 }
00072 
00073 const std::vector<std::string>& AbstractUntemplatedParameterisedSystem::rGetStateVariableNames() const
00074 {
00075     return GetSystemInformation()->rGetStateVariableNames();
00076 }
00077 
00078 const std::vector<std::string>& AbstractUntemplatedParameterisedSystem::rGetStateVariableUnits() const
00079 {
00080     return GetSystemInformation()->rGetStateVariableUnits();
00081 }
00082 
00083 unsigned AbstractUntemplatedParameterisedSystem::GetStateVariableIndex(const std::string& rName) const
00084 {
00085     return GetSystemInformation()->GetStateVariableIndex(rName);
00086 }
00087 
00088 bool AbstractUntemplatedParameterisedSystem::HasStateVariable(const std::string& rName) const
00089 {
00090     return GetSystemInformation()->HasStateVariable(rName);
00091 }
00092 
00093 std::string AbstractUntemplatedParameterisedSystem::GetStateVariableUnits(unsigned index) const
00094 {
00095     return GetSystemInformation()->GetStateVariableUnits(index);
00096 }
00097 
00098 //
00099 // Parameter methods
00100 //
00101 
00102 unsigned AbstractUntemplatedParameterisedSystem::GetNumberOfParameters() const
00103 {
00104     return GetSystemInformation()->rGetParameterNames().size();
00105 }
00106 
00107 const std::vector<std::string>& AbstractUntemplatedParameterisedSystem::rGetParameterNames() const
00108 {
00109     return GetSystemInformation()->rGetParameterNames();
00110 }
00111 
00112 const std::vector<std::string>& AbstractUntemplatedParameterisedSystem::rGetParameterUnits() const
00113 {
00114     return GetSystemInformation()->rGetParameterUnits();
00115 }
00116 
00117 unsigned AbstractUntemplatedParameterisedSystem::GetParameterIndex(const std::string& rName) const
00118 {
00119     return GetSystemInformation()->GetParameterIndex(rName);
00120 }
00121 
00122 bool AbstractUntemplatedParameterisedSystem::HasParameter(const std::string& rName) const
00123 {
00124     return GetSystemInformation()->HasParameter(rName);
00125 }
00126 
00127 std::string AbstractUntemplatedParameterisedSystem::GetParameterUnits(unsigned index) const
00128 {
00129     return GetSystemInformation()->GetParameterUnits(index);
00130 }
00131 
00132 //
00133 // "Any variable" methods
00134 //
00135 
00136 unsigned AbstractUntemplatedParameterisedSystem::GetAnyVariableIndex(const std::string& rName) const
00137 {
00138     return GetSystemInformation()->GetAnyVariableIndex(rName);
00139 }
00140 
00141 bool AbstractUntemplatedParameterisedSystem::HasAnyVariable(const std::string& rName) const
00142 {
00143     return GetSystemInformation()->HasAnyVariable(rName);
00144 }
00145 
00146 std::string AbstractUntemplatedParameterisedSystem::GetAnyVariableUnits(unsigned index) const
00147 {
00148     return GetSystemInformation()->GetAnyVariableUnits(index);
00149 }
00150 
00151 std::string AbstractUntemplatedParameterisedSystem::GetAnyVariableUnits(const std::string& rName) const
00152 {
00153     return GetAnyVariableUnits(GetAnyVariableIndex(rName));
00154 }
00155 
00156 //
00157 // "Derived quantities" methods
00158 //
00159 
00160 unsigned AbstractUntemplatedParameterisedSystem::GetNumberOfDerivedQuantities() const
00161 {
00162     return GetSystemInformation()->rGetDerivedQuantityNames().size();
00163 }
00164 
00165 const std::vector<std::string>& AbstractUntemplatedParameterisedSystem::rGetDerivedQuantityNames() const
00166 {
00167     return GetSystemInformation()->rGetDerivedQuantityNames();
00168 }
00169 
00170 const std::vector<std::string>& AbstractUntemplatedParameterisedSystem::rGetDerivedQuantityUnits() const
00171 {
00172     return GetSystemInformation()->rGetDerivedQuantityUnits();
00173 }
00174 
00175 unsigned AbstractUntemplatedParameterisedSystem::GetDerivedQuantityIndex(const std::string& rName) const
00176 {
00177     return GetSystemInformation()->GetDerivedQuantityIndex(rName);
00178 }
00179 
00180 bool AbstractUntemplatedParameterisedSystem::HasDerivedQuantity(const std::string& rName) const
00181 {
00182     return GetSystemInformation()->HasDerivedQuantity(rName);
00183 }
00184 
00185 std::string AbstractUntemplatedParameterisedSystem::GetDerivedQuantityUnits(unsigned index) const
00186 {
00187     return GetSystemInformation()->GetDerivedQuantityUnits(index);
00188 }
00189 
00190 
00191 unsigned AbstractUntemplatedParameterisedSystem::GetNumberOfAttributes() const
00192 {
00193     return GetSystemInformation()->GetNumberOfAttributes();
00194 }
00195 
00196 bool AbstractUntemplatedParameterisedSystem::HasAttribute(const std::string& rName) const
00197 {
00198     return GetSystemInformation()->HasAttribute(rName);
00199 }
00200 
00201 double AbstractUntemplatedParameterisedSystem::GetAttribute(const std::string& rName) const
00202 {
00203     return GetSystemInformation()->GetAttribute(rName);
00204 }