1#ifndef __FIBER_GRID_FIBER_HPP
2#define __FIBER_GRID_FIBER_HPP "Created 27.02.2001 21:42:27 by werner"
5#include <fiber/field/Field.hpp>
6#include <memcore/TypeInfo.hpp>
7#include <memcore/Ageable.hpp>
8#include <memcore/shared_mutex.hpp>
14#include <fiber/field/BaseSpace.hpp>
52 typename Fields_t::const_iterator f = Fields.
find(
id);
61 Fields_t copy_Fields_map()
const
63 LOCK_RO
lk(fields_mutex);
76 for(
typename Fields_t::const_iterator f = Fields.
begin();
103 return Fields.
size();
115 typename Fields_t::const_iterator f = Fields.
find(
id);
116 if (f==Fields.
end() )
129 void mkFieldID(
const ID&
id)
131 LOCK_WR
lk(fields_mutex);
133 Fields[ id ] =
nullptr;
136 void insertField(
const ID&
id,
const RefPtr<Field>&F)
138 LOCK_WR lk(fields_mutex);
140 typename Fields_t::const_iterator f = Fields.
find(
id);
141 if (f!=Fields.
end() )
158 typename Fields_t::const_iterator f = Fields.
find(
id);
159 if (f==Fields.
end() )
160 return Field::NullPtrField();
169 return F->getCreator(f);
174 RefPtr<CreativeArrayBase>
find(
const ID&
id,
const string&FragmentName)
const
176 const RefPtr<Field>&F =
find(
id);
178 return F->getCreatorByName(FragmentName);
192 void iterate(
const std::function<
bool(
const ID&,
const RefPtr<Field>&)>&F)
const
194 LOCK_RO
lk(fields_mutex);
196 for(
const auto&[
id,f] : Fields)
213 typename Fields_t::const_iterator f = Fields.
find(
id);
214 if (f==Fields.
end() )
234 for(
typename Fields_t::const_iterator f = Fields.
begin();
235 f!=Fields.
end(); f++)
238 if (f->second->isOlderThan (
Oldest ) )
Oldest = *f->second;
252 typename Fields_t::const_iterator it = Fields.
begin();
259 for(; it != Fields.
end(); it++)
265 size_t fragments =
candidate->nFragments();
282 for(
typename Fields_t::const_iterator it = Fields.
begin(); it != Fields.
end(); it++)
306 for(
typename Fields_t::const_iterator it = Fields.
begin(); it != Fields.
end(); it++)
312 if (F->isType( AcceptedFields ) )
322 retval =
" <FIBERSPACE>\n";
324 LOCK_RO
lk(fields_mutex);
325 for(
typename Fields_t::const_iterator
326 it = Fields.
begin(); it != Fields.
end(); it++)
331 retval += it->first->xml();
338 retval +=
" <?INVALID>\n";
339 retval +=
" </FIELD>\n";
341 retval +=
" </FIBERSPACE>\n";
348 LOCK_WR lk(fields_mutex);
350 for(
auto Fit : Fields)
352 if (
const RefPtr<Field>&F = Fit.second)
366 const RefPtr<Field>&getFirstField()
const
368 LOCK_RO lk(fields_mutex);
371 return Field::NullPtrField();
373 return Fields.
begin()->second;
bool empty() const noexcept
const_iterator end() const noexcept
size_type erase(const key_type &__x)
size_type size() const noexcept
iterator find(const key_type &__x)
const_iterator begin() const noexcept
A base class for dependencies on a BaseSpace.
Definition BaseSpace.hpp:19
An iterator with an optional DataCreator, which is just a class to intercept creation of data along a...
Definition CreativeIterator.hpp:34
Base class for fields defined on some base space.
Definition FiberSpace.hpp:33
FiberMap()
Default constructor.
Definition FiberSpace.hpp:93
bool remove(const ID &id)
Remove an Field.
Definition FiberSpace.hpp:209
RefPtr< Field > & create_entry(const ID &id)
Get a modifyable field entry.
Definition FiberSpace.hpp:48
int providesFieldType(const Fiber::TypeList_t &AcceptedFields) const
Check how many fields exist here that conform to the given type.
Definition FiberSpace.hpp:302
Field & operator[](const ID &id)
Access field by name, create one, in case.
Definition FiberSpace.hpp:111
RefPtr< Field > findMostFragmentedField() const
Find the Field with the most fragments.
Definition FiberSpace.hpp:246
RefPtr< FragmentIDCollection > getFragmentIDCollection() const
Return the associated fragment ID collection of the first field that has one.
Definition FiberSpace.hpp:73
const RefPtr< Field > & find(const ID &id) const
Find an entry.
Definition FiberSpace.hpp:154
size_t getNumberOfFields() const
Get the number of fields contained here.
Definition FiberSpace.hpp:100
const RefPtr< Field > & operator()(const ID &id) const
Find an entry, operator interface to the find() member function for convenience.
Definition FiberSpace.hpp:187
int getMemoryUsage(memsize_t &UsedMemory, memsize_t &WantedMemory) const
Memory usage.
Definition FiberSpace.hpp:278
void getMinMaxAge(Ageable &Youngest, Ageable &Oldest) const
Get the youngest/oldest age of all fields contained here, including the fiber space itself taking int...
Definition FiberSpace.hpp:228
A Field is a collection of CreativeArrayBase reference pointers which are accessed via FragmentID obj...
Definition Field.hpp:245
Ageable & touch() noexcept
MemSizeConfig< sizeof(void *)>::memsize_t memsize_t
Given a fragmented field of curvilinear coordinates, (3D array of coordinates), build a uniform Grid ...
Definition FAQ.dox:2
A set of types.
Definition FiberType.hpp:213