52template<
typename T>
const char*
StorageType() {
return "Unknown"; }
92template<
typename T>
class Storage :
public std::enable_shared_from_this<Storage<T>> {
93 const char* type = StorageType<object_type>();
95 std::vector<shared_ptr<T>> fish;
97 const shared_ptr<T> empty =
nullptr;
121 shared_ptr<
T>& operator[](
unsigned);
122 const shared_ptr<
T>&
at(
unsigned) const;
126 [[nodiscard]]
bool find(
unsigned) const;
136 [[nodiscard]]
size_t size() const;
141template<
typename T>
typename Storage<T>::const_iterator
Storage<T>::cend()
const {
return pond.cend(); }
145template<
typename T>
typename Storage<T>::iterator
Storage<T>::end() {
return pond.end(); }
148 auto flag = pond.insert({I->get_tag(), I}).second;
156template<
typename T>
const shared_ptr<T>&
Storage<T>::at(
const unsigned L)
const {
return pond.contains(L) ? pond.at(L) : empty; }
158template<
typename T>
const std::vector<shared_ptr<T>>&
Storage<T>::get()
const {
return fish; }
160template<
typename T>
bool Storage<T>::find(
const unsigned L)
const {
return pond.contains(L); }
164 return pond.unsafe_erase(L) == 1;
166 return pond.erase(L) == 1;
176 fish.reserve(
size());
177 for(
const auto& [tag, obj] : pond)
178 if(obj->is_active()) fish.push_back(obj);
179 else bait.insert(tag);
196template<
typename T>
typename Storage<T>::const_iterator
cbegin(
const Storage<T>&
S) {
return S.cbegin(); }
198template<
typename T>
typename Storage<T>::const_iterator
cend(
const Storage<T>&
S) {
return S.cend(); }
202template<
typename T>
typename Storage<T>::iterator
end(
Storage<T>&
S) {
return S.end(); }
204template<
typename T>
using dual = std::pair<unsigned, shared_ptr<T>>;
const char * StorageType< Criterion >()
Definition: Storage.hpp:62
const char * StorageType()
Definition: Storage.hpp:52
std::pair< unsigned, shared_ptr< T > > dual
Definition: Storage.hpp:204
const char * StorageType< Modifier >()
Definition: Storage.hpp:80
const char * StorageType< Converger >()
Definition: Storage.hpp:60
const char * StorageType< Element >()
Definition: Storage.hpp:70
const char * StorageType< Constraint >()
Definition: Storage.hpp:58
const char * StorageType< Orientation >()
Definition: Storage.hpp:84
const char * StorageType< Expression >()
Definition: Storage.hpp:56
const char * StorageType< Solver >()
Definition: Storage.hpp:90
const char * StorageType< DomainBase >()
Definition: Storage.hpp:68
const char * StorageType< Group >()
Definition: Storage.hpp:72
const char * StorageType< Amplitude >()
Definition: Storage.hpp:54
const char * StorageType< Load >()
Definition: Storage.hpp:76
const char * StorageType< Integrator >()
Definition: Storage.hpp:74
const char * StorageType< Domain >()
Definition: Storage.hpp:66
const char * StorageType< Section >()
Definition: Storage.hpp:88
const char * StorageType< Node >()
Definition: Storage.hpp:82
const char * StorageType< Recorder >()
Definition: Storage.hpp:86
const char * StorageType< Database >()
Definition: Storage.hpp:64
const char * StorageType< Material >()
Definition: Storage.hpp:78
An Amplitude class that can generate Amplitude pattern.
Definition: Amplitude.h:67
A Constraint class.
Definition: Constraint.h:36
The Converger class handles converger test to indicate if the iteration converges according to variou...
Definition: Converger.h:44
A Criterion class.
Definition: Criterion.h:38
A Database class is a top level container.
Definition: Database.h:33
The DomainBase class is a template.
Definition: DomainBase.h:104
A Domain class holds all FE model components.
Definition: Domain.h:38
A Element class.
Definition: Element.h:117
A Expression class represents a maths expression.
Definition: Expression.h:34
The Group class.
Definition: Group.h:36
The Integrator class is basically a wrapper of the DomainBase class with regard to some status changi...
Definition: Integrator.h:51
A Load class.
Definition: Load.h:37
A Material abstract base class.
Definition: Material.h:111
A Modifier class.
Definition: Modifier.h:36
The Node class holds the number of DoFs, coordinate, displacement, velocity and acceleration.
Definition: Node.h:80
A Orientation class.
Definition: Orientation.h:48
A Recorder class.
Definition: Recorder.h:35
A Section class.
Definition: Section.h:77
A Solver class defines solvers used in analysis.
Definition: Solver.h:38
A candidate Storage class that stores FEM objects.
Definition: Storage.hpp:92
bool insert(const shared_ptr< T > &)
Definition: Storage.hpp:147
void reset()
Definition: Storage.hpp:184
shared_ptr< T > & operator[](unsigned)
Definition: Storage.hpp:154
bool find(unsigned) const
Definition: Storage.hpp:160
Storage(const Storage &)=delete
void enable()
Definition: Storage.hpp:182
size_t size() const
Definition: Storage.hpp:194
iterator end()
Definition: Storage.hpp:145
const shared_ptr< T > & at(unsigned) const
Definition: Storage.hpp:156
void clear()
Definition: Storage.hpp:189
void update()
Definition: Storage.hpp:174
const_iterator cend() const
Definition: Storage.hpp:141
iterator begin()
Definition: Storage.hpp:143
bool erase(unsigned)
Definition: Storage.hpp:162
void disable(unsigned)
Definition: Storage.hpp:172
Storage(Storage &&) noexcept=delete
const std::vector< shared_ptr< T > > & get() const
Definition: Storage.hpp:158
T object_type
Definition: Storage.hpp:106
const_iterator cbegin() const
Definition: Storage.hpp:139
std::vector< T > vector
Definition: container.h:53
std::unordered_set< T > unordered_set
Definition: container.h:55
std::unordered_map< T, D > unordered_map
Definition: container.h:57
#define suanpan_warning(...)
Definition: suanPan.h:308