Go to the documentation of this file.00001 #ifndef OPENTISSUE_DYNAMICS_MBD_UTIL_MBD_COMPUTE_CONTACT_COUNT_H
00002 #define OPENTISSUE_DYNAMICS_MBD_UTIL_MBD_COMPUTE_CONTACT_COUNT_H
00003
00004
00005
00006
00007
00008
00009
00010 #include <OpenTissue/configuration.h>
00011
00012 namespace OpenTissue
00013 {
00014 namespace mbd
00015 {
00016
00028 template< typename indirect_body_iterator>
00029 size_t compute_contact_count(indirect_body_iterator begin, indirect_body_iterator end)
00030 {
00031 typedef typename indirect_body_iterator::value_type body_type;
00032 typedef typename body_type::indirect_edge_iterator indirect_edge_iterator;
00033
00034 size_t cnt = 0;
00035
00036 for(indirect_body_iterator body=begin;body!=end;++body)
00037 {
00038 for(indirect_edge_iterator edge=body->edge_begin();edge!=body->edge_end();++edge)
00039 {
00040 if(edge->is_up_to_date() )
00041 cnt += edge->size_contacts();
00042 }
00043 }
00044
00045
00046 return (cnt/2);
00047 }
00048
00049 }
00050
00051 }
00052
00053
00054 #endif