Re: [Boost-users] problem of getting vertex_index_t property
Thx for your reply. But I use vecS to store vertices instead of setS. The setS is for storing edges. There should be something else going wrong. 在 2015年7月23日 星期四 10:32:28,boost-users-request@lists.boost.org 写道:
Send Boost-users mailing list submissions to boost-users@lists.boost.org
To subscribe or unsubscribe via the World Wide Web, visit http://lists.boost.org/mailman/listinfo.cgi/boost-users or, via email, send a message with subject or body 'help' to boost-users-request@lists.boost.org
You can reach the person managing the list at boost-users-owner@lists.boost.org
When replying, please edit your Subject line so it is more specific than "Re: Contents of Boost-users digest..."
Today's Topics:
1. Re: [interval] Errors using transc.hpp WAS: Power (Sensei) 2. problem of getting vertex_index_t property with BGL (breadbread1984) 3. Re: problem of getting vertex_index_t property with BGL (Jeremiah Willcock) 4. Re: Boost.DateTime and leap year/leap seconds (Auer, Jens)
----------------------------------------------------------------------
Message: 1 Date: Thu, 23 Jul 2015 10:03:47 +0200 From: Sensei <senseiwa@gmail.com> To: boost-users@lists.boost.org Subject: Re: [Boost-users] [interval] Errors using transc.hpp WAS: Power Message-ID: <55B09FE3.20108@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed
Dear all,
I've tried to move beyond simple exp/log functions, but this problem
/usr/local/include/boost/numeric/interval/transc.hpp:47:42: No member named 'log_down' in 'boost::numeric::interval_lib::rounded_math<double>'
/usr/local/include/boost/numeric/interval/transc.hpp:34:16: No member named 'exp_down' in 'boost::numeric::interval_lib::rounded_math<double>'
arises with *all* of the functions contained in transc.hpp, and I don't know what I'm doing wrong here.
Can anyone help me?
Thanks!
------------------------------
Message: 2 Date: Thu, 23 Jul 2015 18:25:39 +0800 From: breadbread1984 <breadbread1984@163.com> To: boost-users@lists.boost.org Subject: [Boost-users] problem of getting vertex_index_t property with BGL Message-ID: <2807116.uu1eRmarTQ@xieyi-paf4> Content-Type: text/plain; charset="utf-8"
I am using boost graph library. I found there is a built in property vertex_index_t corresponding to every vertex from the document [here](http://www.boost.org/doc/libs/1_58_0/libs/graph/doc/adjacency_list.h tml). But when I get the vertex_index_t property the compiler prompt the following error:
CooperativeGraph.h:59:36: required from here /usr/include/boost/graph/detail/adjacency_list.hpp:2498:29: error: forming reference to void typedef value_type& reference; ^ /usr/include/boost/graph/detail/adjacency_list.hpp:2499:35: error: forming reference to void typedef const value_type& const_reference; ^ /usr/include/boost/graph/detail/adjacency_list.hpp:2502:47: error: forming reference to void <Graph, value_type, reference, Tag> type; ^ /usr/include/boost/graph/detail/adjacency_list.hpp:2504:53: error: forming reference to void <Graph, value_type, const_reference, Tag> const_type; ^ CooperativeGraph.cpp: In member function ?void CooperativeGraph::getProperties()?: CooperativeGraph.cpp:384:35: error: no matching function for call to ?get(boost::vertex_index_t, Graph&)? vertex_index = get(vertex_index,g); ^ I defined the data structure as follows
typedef property<vertex_BatteryLevel_t,int, property<vertex_ObservationHistory_t,deque<Observation>, property<vertex_name_t,uuid>
vertex_state;
typedef property<edge_QFunction_t,QTable, property<edge_Eligibility_t,Eligibility>
edge_qfunction;
typedef adjacency_list< vecS,setS,directedS, vertex_state, edge_qfunction
Graph;
Does anyone know what I am doing wrong? Why can't I get the vertex_index_t property. Thanks!
------------------------------
Message: 3 Date: Thu, 23 Jul 2015 14:06:03 +0000 (UTC) From: Jeremiah Willcock <jewillco@yahoo.com> To: "boost-users@lists.boost.org" <boost-users@lists.boost.org> Subject: Re: [Boost-users] problem of getting vertex_index_t property with BGL Message-ID: <983493185.1183146.1437660363876.JavaMail.yahoo@mail.yahoo.com> Content-Type: text/plain; charset=UTF-8
________________________________
From: breadbread1984 <breadbread1984@163.com>
To: boost-users@lists.boost.org Sent: Thursday, July 23, 2015 4:25 AM Subject: [Boost-users] problem of getting vertex_index_t property with BGL
I am using boost graph library. I found there is a built in property vertex_index_t corresponding to every vertex from the document [here](http://www.boost.org/doc/libs/1_58_0/libs/graph/doc/adjacency_list. html). But when I get the vertex_index_t property the compiler prompt the following error:
CooperativeGraph.h:59:36: required from here /usr/include/boost/graph/detail/adjacency_list.hpp:2498:29: error: forming reference to void> typedef value_type& reference;
^
/usr/include/boost/graph/detail/adjacency_list.hpp:2499:35: error: forming reference to void> typedef const value_type& const_reference;
^
/usr/include/boost/graph/detail/adjacency_list.hpp:2502:47: error: forming reference to void> <Graph, value_type, reference, Tag> type;
^
/usr/include/boost/graph/detail/adjacency_list.hpp:2504:53: error: forming reference to void> <Graph, value_type, const_reference, Tag> const_type;
^
CooperativeGraph.cpp: In member function ?void CooperativeGraph::getProperties()?: CooperativeGraph.cpp:384:35: error: no matching function for call to ?get(boost::vertex_index_t, Graph&)?> vertex_index = get(vertex_index,g);
^
I defined the data structure as follows
typedef property<vertex_BatteryLevel_t,int,
property<vertex_ObservationHistory_t,deque<Observation>,
property<vertex_name_t,uuid>
vertex_state;
typedef property<edge_QFunction_t,QTable,
property<edge_Eligibility_t,Eligibility>
edge_qfunction;
typedef adjacency_list<
vecS,setS,directedS, vertex_state, edge_qfunction
Graph;
Does anyone know what I am doing wrong? Why can't I get the vertex_index_t property. Thanks! Your graph type has setS as its vertex container. Try using vecS instead to get the vertex_index property to be present.
-- Jeremiah Willcock
------------------------------
Message: 4 Date: Thu, 23 Jul 2015 14:31:51 +0000 From: "Auer, Jens" <jens.auer@cgi.com> To: "boost-users@lists.boost.org" <boost-users@lists.boost.org> Subject: Re: [Boost-users] Boost.DateTime and leap year/leap seconds Message-ID: <E47848702ADBE04EA7ECF45E05F60B6DF98E840C@SE-EX020.groupinfra.com> Content-Type: text/plain; charset="utf-8"
Hi Howard,
Thank you very much. That basically made my day!
We have no restrictions on the compiler, currently I'm using gcc 4.9 in C++-14 mode. I think I can also justify using a time handling library, so the chances are very good that we will use your library.
Many thanks and best wishes, Jens
-- Dr. Jens Auer | CGI | Software Engineer CGI Deutschland Ltd. & Co. KG Rheinstra?e 95 | 64295 Darmstadt | Germany T: +49 6151 36860 154 jens.auer@cgi.com Unsere Pflichtangaben gem?? ? 35a GmbHG / ?? 161, 125a HGB finden Sie unter de.cgi.com/pflichtangaben.
CONFIDENTIALITY NOTICE: Proprietary/Confidential information belonging to CGI Group Inc. and its affiliates may be contained in this message. If you are not a recipient indicated or intended in this message (or responsible for delivery of this message to such person), or you think for any reason that this message may have been addressed to you in error, you may not use or copy or deliver this message to anyone else. In such case, you should destroy this message and are asked to notify the sender by reply e-mail.
-----Original Message----- From: Boost-users [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Howard Hinnant Sent: 22 July 2015 21:29 To: boost-users@lists.boost.org Subject: Re: [Boost-users] Boost.DateTime and leap year/leap seconds
I?ve been following this thread with interest.
Reading the documentation I think that will not be correct when there were leap seconds. Correct. As Jeff said earlier, leap second support is not in the current
On Jul 22, 2015, at 8:59 AM, Auer, Jens <jens.auer@cgi.com> wrote: library, but might be a feature in a future boost date-time 2.0.
If you are using a C++11 or C++14 compiler, there is a library that will handle this problem with leap seconds taken into account for you:
http://howardhinnant.github.io/tz.html
I doubt you can use this library as the space industry equates up-to-date compilers with increased risk. However I mention it, as it is open source and perhaps you can crib some of its ideas onto the current boost date-time library.
In a nutshell, this C++11/14 library handles leap seconds along the lines of what Jeff suggested. Though in this case it creates a std::chrono - compatible clock which is leap second aware:
class utc_clock { public: using duration = std::chrono::system_clock::duration; using rep = duration::rep; using period = duration::period; using time_point = std::chrono::time_point<utc_clock>; static constexpr bool is_steady = true;
static time_point now() noexcept;
template <class Duration> static std::chrono::time_point<utc_clock, typename std::common_type<Duration, std::chrono::seconds>::type> sys_to_utc(std::chrono::time_point<std::chrono::system_clock, Duration> t);
template <class Duration> static std::chrono::time_point<std::chrono::system_clock, typename std::common_type<Duration, std::chrono::seconds>::type> utc_to_sys(std::chrono::time_point<utc_clock, Duration> t); };
and includes conversions to and from std::chrono::system_clock::time_point (which like boost date-time is based on Unix time). These conversions are simply lookups into an ordered list of leap second transitions, resulting in the addition or subtraction of the proper number of leap seconds.
This could be used like so:
struct CCSDS { std::uint16_t days; std::uint32_t ms; std::uint16_t us; };
CCSDS to_CCSDS(date::year y, std::chrono::microseconds us) { using namespace date; using namespace std::chrono; auto utc = utc_clock::sys_to_utc(day_point(y/jan/1)) + us; auto sys = utc_clock::utc_to_sys(utc); auto dp = floor<days>(sys); auto d = dp - day_point(1958_y/jan/1); us = utc - utc_clock::sys_to_utc(dp); auto ms = duration_cast<milliseconds>(us); us -= ms; return {static_cast<std::uint16_t>(d.count()), static_cast<std::uint32_t>(ms.count()), static_cast<std::uint16_t>(us.count())}; }
The variable utc holds the ?year + us? as a time point with microseconds precision. This time point counts microseconds, including leap seconds, since 1970-01-01 00:00:00 UTC.
The next step is find when the day started that is associated with utc. To do this one must convert utc back to ?Unix time?, and then truncate that time point to a precision of days, resulting in the variable dp. dp is a count of days since 1970-01-01. Since your epoch is 1958-01-01, this is taken into account in creating ?d?, the first value needed in your return type.
Now the number of microseconds since the start of the day needs to be computed. The start of the day, dp, is converted back into the leap-second aware system, and subtracted from the microsecond time point: utc. The variable us is reused to hold ?microseconds since midnight?. Now it is a simple computation to split this into milliseconds since midnight, and microseconds since the last millisecond.
This has all been tested with:
void test_to_CCSDS() { using namespace std::chrono; using namespace date; for (auto d = days{179}; d <= days{181}; ++d) { auto start = d + 86399s + 999999us + 0us; for (auto us = start; us <= start + 3s; us += 1s) { auto t = to_CCSDS(2015_y, us); std::cout << t.days << ' ' << t.ms << ' ' << t.us << '\n'; } std::cout << '\n'; } }
which yields:
20998 86399999 999 20999 999 999 20999 1999 999 20999 2999 999
20999 86399999 999 20999 86400999 999 21000 999 999 21000 1999 999
21000 86398999 999 21000 86399999 999 21001 999 999 21001 1999 999
Interpretation: On 2015-06-29 23:59:59.999999 we are 1us away from the next day. 1s later we are well into 2015-06-30.
24hrs later, we see a different pattern as the leap second is inserted. The last microsecond of the day is 1s later at 2015-06030 23:59:60.999999.
24hrs later we are back to days with only 86400s.
Assuming you have some conversion data to test against, this will hopefully match up with those test cases.
Howard
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
------------------------------
Subject: Digest Footer
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
------------------------------
End of Boost-users Digest, Vol 4202, Issue 3 ********************************************
From: breadbread1984 <breadbread1984@163.com>
To: boost-users@lists.boost.org Cc: Sent: Thursday, July 23, 2015 9:29 AM Subject: Re: [Boost-users] problem of getting vertex_index_t property
T hx for your reply. But I use vecS to store vertices instead of setS. The setS is for storing edges. There should be something else going wrong.
typedef adjacency_list< vecS,setS,directedS, vertex_state, edge_qfunction
Graph;
According to the documentation, you have vecS as out edge container and setS as vertex container. The template parameter list in http://www.boost.org/doc/libs/1_58_0/libs/graph/doc/adjacency_list.html is given as: adjacency_list<OutEdgeList, VertexList, Directed, VertexProperties, EdgeProperties, GraphProperties, EdgeList> -- Jeremiah Willcock
participants (2)
-
breadbread1984
-
Jeremiah Willcock