22#ifndef BELFEM_CL_COCHAIN_HPP
23#define BELFEM_CL_COCHAIN_HPP
48 Cochain * mCoboundary =
nullptr;
53 bool mIsBound =
false;
54 bool mIsCobound =
false;
61 const bool aIsBound,
const bool aIsCobound) ;
166 return mSimplicesMap;
174 auto it = mSimplicesMap.
find(aID);
175 if (it != mSimplicesMap.end()) {
212 mBoundary->add_simplex_to_cochain(aID,aCoeff);
246 mSimplicesMap.erase_key(aID);
250 mSimplicesMap[aID] = tCoeff;
259 if ( aCoeff == 0 )
return;
261 auto & tMap = mSimplicesMap.map_data() ;
262 auto tIterator = tMap.find(aID) ;
264 if ( tIterator != tMap.end() )
267 tIterator->second += aCoeff;
270 if ( tIterator->second == 0 )
272 tMap.erase( tIterator ) ;
278 tMap[ aID ] = aCoeff ;
289 if ( aCoeff == 0 )
return;
291 if (mDim == aCochain->
get_dim())
298 if(mDim != 0 and !mIsBound)
300 mBoundary->add_cochain_to_cochain(aCochain->
get_boundary(),aCoeff);
303 if (mDim != 3 and !mIsCobound)
305 mCoboundary->add_cochain_to_cochain(aCochain->
get_coboundary(),aCoeff);
311 std::cout <<
"Dimensions don't agree, not adding the cochain" << std::endl;
Top-level container for all mesh entities.
Definition cl_Mesh.hpp:60
auto find(const Key &tKey) const -> decltype(mMap.find(tKey))
Definition cl_OrderedMap.hpp:139
Formal sum of k-simplices (homology).
Definition cl_Chain.hpp:36
Cochain: a functional on chains (cohomology).
Definition cl_Cochain.hpp:37
void print()
Definition cl_Cochain.cpp:118
bool isCobound()
Definition cl_Cochain.hpp:234
void add_simplex_to_boundary(index_t aID, const int aCoeff)
Definition cl_Cochain.hpp:210
void add_cochain_to_cochain(Cochain *aCochain, const int aCoeff)
Definition cl_Cochain.hpp:287
void add_simplex_to_cochain(const index_t aID, const int aCoeff)
Definition cl_Cochain.hpp:257
int get_coefficient(const index_t aID)
Definition cl_Cochain.hpp:172
Cochain * get_boundary()
Definition cl_Cochain.hpp:194
void remove_cochain_from_cochain(Cochain *aChain)
Definition cl_Cochain.cpp:100
Cochain(const uint aDim, Mesh *aMesh, const bool aIsBound, const bool aIsCobound)
Definition cl_Cochain.cpp:21
void remove_simplex_from_cochain(const index_t aID)
Definition cl_Cochain.cpp:91
int get_dim()
Definition cl_Cochain.hpp:218
void operator-(Cochain *aCochain)
Definition cl_Cochain.cpp:65
int operator()(Chain *aChain)
Definition cl_Cochain.cpp:73
void add_simplex_to_coboundary(index_t aID, const int aCoeff)
Definition cl_Cochain.hpp:202
void operator+(Cochain *aCochain)
Definition cl_Cochain.cpp:57
void set_coefficient(const index_t aID, const int tCoeff)
Definition cl_Cochain.hpp:242
OrderedMap< index_t, int > & get_simplices_map()
Definition cl_Cochain.hpp:164
bool isBound()
Definition cl_Cochain.hpp:226
Cochain * get_coboundary()
Definition cl_Cochain.hpp:186
Definition cl_EF_EdgeFunction.hpp:24
USER GUIDES:
Definition cl_Capacitor.cpp:16
unsigned int uint
Definition typedefs.hpp:30
uint32_t index_t
Definition typedefs.hpp:52