File size: 162,919 Bytes
803451e
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
{"text": "#ifndef BOOST_GEOMETRY_PROJECTIONS_VANDG2_HPP\n#define BOOST_GEOMETRY_PROJECTIONS_VANDG2_HPP\n\n// Boost.Geometry - extensions-gis-projections (based on PROJ4)\n// This file is automatically generated. DO NOT EDIT.\n\n// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.\n\n// Use, modification and distribution is subject to the Boost Software License,\n// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at\n// http://www.boost.org/LICENSE_1_0.txt)\n\n// This file is converted from PROJ4, http://trac.osgeo.org/proj\n// PROJ4 is originally written by Gerald Evenden (then of the USGS)\n// PROJ4 is maintained by Frank Warmerdam\n// PROJ4 is converted to Boost.Geometry by Barend Gehrels\n\n// Last updated version of proj: 4.9.1\n\n// Original copyright notice:\n\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the \"Software\"),\n// to deal in the Software without restriction, including without limitation\n// the rights to use, copy, modify, merge, publish, distribute, sublicense,\n// and/or sell copies of the Software, and to permit persons to whom the\n// Software is furnished to do so, subject to the following conditions:\n\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n// DEALINGS IN THE SOFTWARE.\n\n#include <boost/geometry/util/math.hpp>\n\n#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>\n#include <boost/geometry/extensions/gis/projections/impl/base_dynamic.hpp>\n#include <boost/geometry/extensions/gis/projections/impl/projects.hpp>\n#include <boost/geometry/extensions/gis/projections/impl/factory_entry.hpp>\n\nnamespace boost { namespace geometry { namespace projections\n{\n    #ifndef DOXYGEN_NO_DETAIL\n    namespace detail { namespace vandg2\n    {\n\n            static const double TOL = 1e-10;\n            static const double TWORPI = 0.63661977236758134308;\n\n            struct par_vandg2\n            {\n                int    vdg3;\n            };\n\n            // template class, using CRTP to implement forward/inverse\n            template <typename Geographic, typename Cartesian, typename Parameters>\n            struct base_vandg2_spheroid : public base_t_f<base_vandg2_spheroid<Geographic, Cartesian, Parameters>,\n                     Geographic, Cartesian, Parameters>\n            {\n\n                 typedef double geographic_type;\n                 typedef double cartesian_type;\n\n                par_vandg2 m_proj_parm;\n\n                inline base_vandg2_spheroid(const Parameters& par)\n                    : base_t_f<base_vandg2_spheroid<Geographic, Cartesian, Parameters>,\n                     Geographic, Cartesian, Parameters>(*this, par) {}\n\n                // FORWARD(s_forward)  spheroid\n                // Project coordinates from geographic (lon, lat) to cartesian (x, y)\n                inline void fwd(geographic_type& lp_lon, geographic_type& lp_lat, cartesian_type& xy_x, cartesian_type& xy_y) const\n                {\n                    double x1, at, bt, ct;\n\n                    bt = fabs(TWORPI * lp_lat);\n                    if ((ct = 1. - bt * bt) < 0.)\n                        ct = 0.;\n                    else\n                        ct = sqrt(ct);\n                    if (fabs(lp_lon) < TOL) {\n                        xy_x = 0.;\n                        xy_y = geometry::math::pi<double>() * (lp_lat < 0. ? -bt : bt) / (1. + ct);\n                    } else {\n                        at = 0.5 * fabs(geometry::math::pi<double>() / lp_lon - lp_lon / geometry::math::pi<double>());\n                        if (this->m_proj_parm.vdg3) {\n                            x1 = bt / (1. + ct);\n                            xy_x = geometry::math::pi<double>() * (sqrt(at * at + 1. - x1 * x1) - at);\n                            xy_y = geometry::math::pi<double>() * x1;\n                        } else {\n                            x1 = (ct * sqrt(1. + at * at) - at * ct * ct) /\n                                (1. + at * at * bt * bt);\n                            xy_x = geometry::math::pi<double>() * x1;\n                            xy_y = geometry::math::pi<double>() * sqrt(1. - x1 * (x1 + 2. * at) + TOL);\n                        }\n                        if ( lp_lon < 0.) xy_x = -xy_x;\n                        if ( lp_lat < 0.) xy_y = -xy_y;\n                    }\n                }\n\n                static inline std::string get_name()\n                {\n                    return \"vandg2_spheroid\";\n                }\n\n            };\n\n            // van der Grinten II\n            template <typename Parameters>\n            void setup_vandg2(Parameters& par, par_vandg2& proj_parm)\n            {\n                proj_parm.vdg3 = 0;\n            }\n\n            // van der Grinten III\n            template <typename Parameters>\n            void setup_vandg3(Parameters& par, par_vandg2& proj_parm)\n            {\n                proj_parm.vdg3 = 1;\n                par.es = 0.;\n            }\n\n        }} // namespace detail::vandg2\n    #endif // doxygen\n\n    /*!\n        \\brief van der Grinten II projection\n        \\ingroup projections\n        \\tparam Geographic latlong point type\n        \\tparam Cartesian xy point type\n        \\tparam Parameters parameter type\n        \\par Projection characteristics\n         - Miscellaneous\n         - Spheroid\n         - no inverse\n        \\par Example\n        \\image html ex_vandg2.gif\n    */\n    template <typename Geographic, typename Cartesian, typename Parameters = parameters>\n    struct vandg2_spheroid : public detail::vandg2::base_vandg2_spheroid<Geographic, Cartesian, Parameters>\n    {\n        inline vandg2_spheroid(const Parameters& par) : detail::vandg2::base_vandg2_spheroid<Geographic, Cartesian, Parameters>(par)\n        {\n            detail::vandg2::setup_vandg2(this->m_par, this->m_proj_parm);\n        }\n    };\n\n    /*!\n        \\brief van der Grinten III projection\n        \\ingroup projections\n        \\tparam Geographic latlong point type\n        \\tparam Cartesian xy point type\n        \\tparam Parameters parameter type\n        \\par Projection characteristics\n         - Miscellaneous\n         - Spheroid\n         - no inverse\n        \\par Example\n        \\image html ex_vandg3.gif\n    */\n    template <typename Geographic, typename Cartesian, typename Parameters = parameters>\n    struct vandg3_spheroid : public detail::vandg2::base_vandg2_spheroid<Geographic, Cartesian, Parameters>\n    {\n        inline vandg3_spheroid(const Parameters& par) : detail::vandg2::base_vandg2_spheroid<Geographic, Cartesian, Parameters>(par)\n        {\n            detail::vandg2::setup_vandg3(this->m_par, this->m_proj_parm);\n        }\n    };\n\n    #ifndef DOXYGEN_NO_DETAIL\n    namespace detail\n    {\n\n        // Factory entry(s)\n        template <typename Geographic, typename Cartesian, typename Parameters>\n        class vandg2_entry : public detail::factory_entry<Geographic, Cartesian, Parameters>\n        {\n            public :\n                virtual projection<Geographic, Cartesian>* create_new(const Parameters& par) const\n                {\n                    return new base_v_f<vandg2_spheroid<Geographic, Cartesian, Parameters>, Geographic, Cartesian, Parameters>(par);\n                }\n        };\n\n        template <typename Geographic, typename Cartesian, typename Parameters>\n        class vandg3_entry : public detail::factory_entry<Geographic, Cartesian, Parameters>\n        {\n            public :\n                virtual projection<Geographic, Cartesian>* create_new(const Parameters& par) const\n                {\n                    return new base_v_f<vandg3_spheroid<Geographic, Cartesian, Parameters>, Geographic, Cartesian, Parameters>(par);\n                }\n        };\n\n        template <typename Geographic, typename Cartesian, typename Parameters>\n        inline void vandg2_init(detail::base_factory<Geographic, Cartesian, Parameters>& factory)\n        {\n            factory.add_to_factory(\"vandg2\", new vandg2_entry<Geographic, Cartesian, Parameters>);\n            factory.add_to_factory(\"vandg3\", new vandg3_entry<Geographic, Cartesian, Parameters>);\n        }\n\n    } // namespace detail\n    #endif // doxygen\n\n}}} // namespace boost::geometry::projections\n\n#endif // BOOST_GEOMETRY_PROJECTIONS_VANDG2_HPP\n\n", "meta": {"hexsha": "b4ff3140b866b48d649f867539e9fa2abc23a697", "size": 8779, "ext": "hpp", "lang": "C++", "max_stars_repo_path": "3party/boost/boost/geometry/extensions/gis/projections/proj/vandg2.hpp", "max_stars_repo_name": "bowlofstew/omim", "max_stars_repo_head_hexsha": "8045157c95244aa8f862d47324df42a19b87e335", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 1.0, "max_stars_repo_stars_event_min_datetime": "2019-01-11T05:02:05.000Z", "max_stars_repo_stars_event_max_datetime": "2019-01-11T05:02:05.000Z", "max_issues_repo_path": "3party/boost/boost/geometry/extensions/gis/projections/proj/vandg2.hpp", "max_issues_repo_name": "bowlofstew/omim", "max_issues_repo_head_hexsha": "8045157c95244aa8f862d47324df42a19b87e335", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "3party/boost/boost/geometry/extensions/gis/projections/proj/vandg2.hpp", "max_forks_repo_name": "bowlofstew/omim", "max_forks_repo_head_hexsha": "8045157c95244aa8f862d47324df42a19b87e335", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": 2.0, "max_forks_repo_forks_event_min_datetime": "2018-04-04T10:55:01.000Z", "max_forks_repo_forks_event_max_datetime": "2020-04-23T18:52:06.000Z", "avg_line_length": 40.8325581395, "max_line_length": 132, "alphanum_fraction": 0.6049663971, "num_tokens": 1998, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO\n\n", "lm_q1_score": 0.523420348936324, "lm_q2_score": 0.28457600421652673, "lm_q1q2_score": 0.14895287142591926}}
{"text": "/*\n * This file is a part of the TChecker project.\n *\n * See files AUTHORS and LICENSE for copyright details.\n *\n */\n\n#ifndef TCHECKER_REFZG_SEMANTICS_HH\n#define TCHECKER_REFZG_SEMANTICS_HH\n\n#include <boost/dynamic_bitset.hpp>\n\n#include \"tchecker/basictypes.hh\"\n#include \"tchecker/dbm/db.hh\"\n#include \"tchecker/variables/clocks.hh\"\n\n/*!\n \\file semantics.hh\n \\brief Operational semantics on DBMs with reference clocks\n */\n\nnamespace tchecker {\n\nnamespace refzg {\n\n/*!\n \\class semantics_t\n \\brief Semantics for zone graphs implemented by DBMs with reference clocks\n */\nclass semantics_t {\npublic:\n  /*!\n  \\brief Destructor\n   */\n  virtual ~semantics_t() = default;\n\n  /*!\n  \\brief Compute initial zone with reference clocks\n  \\param rdbm : a DBM\n  \\param r : reference clocks for rdbm\n  \\param delay_allowed : set of reference clocks allowed to delay\n  \\param invariant : invariant\n  \\param spread : reference clocks spread\n  \\pre rdbm is not nullptr (checked by assertion).\n  rdbm is a r.size()*r.size() array of difference bounds.\n  rdbm is tight and consistent.\n  the size of delay_allowed is the number of reference clocks in r\n  \\post dbm is the initial zone w.r.t. delay_allowed, invariant and spread\n  \\return STATE_OK if the resulting DBM is not empty, other values if the\n  resulting DBM is empty (see details in implementations)\n   */\n  virtual tchecker::state_status_t initial(tchecker::dbm::db_t * rdbm, tchecker::reference_clock_variables_t const & r,\n                                           boost::dynamic_bitset<> const & delay_allowed,\n                                           tchecker::clock_constraint_container_t const & invariant) = 0;\n\n  /*!\n  \\brief Compute next zone with reference clocks\n  \\param rdbm : a DBM\n  \\param r : reference clocks for rdbm\n  \\param src_delay_allowed : set of reference clocks allowed to delay in source\n  state\n  \\param src_invariant : invariant in source state\n  \\param sync_ref_clocks : set of reference clocks to synchronize\n  \\param guard : transition guard\n  \\param clkreset : transition reset\n  \\param tgt_delay_allowed : set of reference clocks allowed to delay in target\n  state\n  \\param tgt_invariant : invariant in target state\n  \\pre rdbm is not nullptr (checked by assertion).\n  rdbm is a r.size()*r.size() array of difference bounds.\n  rdbm is tight and consistent.\n  the size of src_delay_allowed is the number of reference clocks in r.\n  the size of sync_ref_clocks is the number of reference clocks in r.\n  the size of tgt_delay_allowed is the number of reference clocks in r\n  \\post rdbm has been updated to its strongest postcondition w.r.t. src_delay_allowed,\n  src_invariant, sync_ref_clocks, guard, clkreset, tgt_delay_allowed and tgt_invariant\n  \\return STATE_OK if the resulting DBM is not empty, other values if the resulting\n  DBM is empty (see details in implementations)\n   */\n  virtual tchecker::state_status_t\n  next(tchecker::dbm::db_t * rdbm, tchecker::reference_clock_variables_t const & r,\n       boost::dynamic_bitset<> const & src_delay_allowed, tchecker::clock_constraint_container_t const & src_invariant,\n       boost::dynamic_bitset<> const & sync_ref_clocks, tchecker::clock_constraint_container_t const & guard,\n       tchecker::clock_reset_container_t const & clkreset, boost::dynamic_bitset<> const & tgt_delay_allowed,\n       tchecker::clock_constraint_container_t const & tgt_invariant) = 0;\n};\n\n/*!\n\\class standard_semantics_t\n\\brief Standard semantics: each transition in the zone graph consists of a delay\n(if allowed) followed by a transition from the timed automaton\n*/\nclass standard_semantics_t final : public tchecker::refzg::semantics_t {\npublic:\n  /*!\n  \\brief Destructor\n  */\n  virtual ~standard_semantics_t() = default;\n\n  /*!\n  \\brief Compute initial zone with reference clocks\n  \\param rdbm : a DBM\n  \\param r : reference clocks for rdbm\n  \\param delay_allowed : set of reference clocks allowed to delay\n  \\param invariant : invariant\n  \\pre rdbm is not nullptr (checked by assertion).\n  rdbm is a r.size()*r.size() array of difference bounds.\n  rdbm is tight and consistent.\n  the size of delay_allowed is the number of reference clocks in r (checked\n  by assertion)\n  \\post rdbm is the zone that only containts the zero valuation\n  \\return tchecker::STATE_OK if the resulting DBM is not empty. Otherwise,\n  tchecker::STATE_CLOCKS_SRC_INVARIANT_VIOLATED if the zero valuation does not\n  satisfy invariant.\n  */\n  virtual tchecker::state_status_t initial(tchecker::dbm::db_t * rdbm, tchecker::reference_clock_variables_t const & r,\n                                           boost::dynamic_bitset<> const & delay_allowed,\n                                           tchecker::clock_constraint_container_t const & invariant);\n\n  /*!\n  \\brief Compute next zone with reference clocks\n  \\param rdbm : a DBM\n  \\param r : reference clocks for dbm\n  \\param src_delay_allowed : set of reference clocks allowed to delay in source\n  state\n  \\param src_invariant : invariant in source state\n  \\param sync_ref_clocks : set of reference clocks to synchronize\n  \\param guard : transition guard\n  \\param clkreset : transition reset\n  \\param tgt_delay_allowed : set of reference clocks allowed to delay in target\n  state\n  \\param tgt_invariant : invariant in target state\n  \\pre rdbm is not nullptr (checked by assertion).\n  rdbm is a r.size()*r.size() array of difference bounds.\n  rdbm is not tight and consistent.\n  the size of src_delay_allowed is the number of reference clocks in r\n  (checked by assertion).\n  The size of sync_ref_clocks is the number of reference clocks in r (checked by\n  assertion).)\n  The size of tgt_delay_allowed is the number of reference clocks in r (checked\n  by assertion).\n  \\post rdbm has been delayed (only reference clocks which are allowed in\n  src_delay_allowed), then intersected with src_invariant, then all reference\n  clocks in sync_ref_clocks have been synchronized in rdbm, then rdbm has been\n  intersected with guard, then dbm has been reset w.r.t clkreset, then\n  intersected with tgt_invariant\n  \\return tchecker::STATE_OK if the resulting DBM is not empty. Otherwise,\n  tchecker::STATE_CLOCKS_SRC_INVARIANT_VIOLATED if intersection with src_invariant\n  result in an empty zone, tchecker::STATE_CLOCKS_SYNC_EMPTY if synchronization\n  of reference clocks in sync_ref_clocks yield an empty zone,\n  tchecker::STATE_CLOCKS_GUARD_VIOLATED if intersection with guard result in an\n  empty zone, tchecker::STATE_EMPTY_SYNC if synchronization of reference clocks\n  result in an empty zone, tchecker::STATE_CLOCKS_TGT_INVARIANT_VIOLATED if\n  intersection with tgt_invariant result in an empty zone\n  */\n  virtual tchecker::state_status_t\n  next(tchecker::dbm::db_t * rdbm, tchecker::reference_clock_variables_t const & r,\n       boost::dynamic_bitset<> const & src_delay_allowed, tchecker::clock_constraint_container_t const & src_invariant,\n       boost::dynamic_bitset<> const & sync_ref_clocks, tchecker::clock_constraint_container_t const & guard,\n       tchecker::clock_reset_container_t const & clkreset, boost::dynamic_bitset<> const & tgt_delay_allowed,\n       tchecker::clock_constraint_container_t const & tgt_invariant);\n};\n\n/*!\n\\class elapsed_semantics_t\n\\brief elapsed semantics: each transition in the zone graph consists of a\ntransition from the automaton, followed by a delay (if allowed)\n*/\nclass elapsed_semantics_t final : public tchecker::refzg::semantics_t {\npublic:\n  /*!\n  \\brief Destructor\n  */\n  virtual ~elapsed_semantics_t() = default;\n\n  /*!\n  \\brief Compute initial zone with reference clocks\n  \\param rdbm : a DBM\n  \\param r : reference clocks for rdbm\n  \\param delay_allowed : set of reference clocks allowed to delay\n  \\param invariant : invariant\n  \\pre rdbm is not nullptr (checked by assertion).\n  rdbm is a r.size()*r.size() array of difference bounds.\n  rdbm is not tight and consistent.\n  the size of delay_allowed is the number of reference clocks in r (checked\n  by assertion))\n  \\post rdbm is the zone that contains all the time successors of the zero\n  valuation (for reference clocks that are allowed to delay in delay_allowed),\n  and that satisfy invariant\n  \\return tchecker::STATE_OK if the resulting DBM is not empty. Otherwise,\n  tchecker::STATE_CLOCKS_SRC_INVARIANT_VIOLATED if the (time successors of the)\n  zero valuation does not satisfy invariant.\n  */\n  virtual tchecker::state_status_t initial(tchecker::dbm::db_t * rdbm, tchecker::reference_clock_variables_t const & r,\n                                           boost::dynamic_bitset<> const & delay_allowed,\n                                           tchecker::clock_constraint_container_t const & invariant);\n\n  /*!\n  \\brief Compute next zone with reference clocks\n  \\param rdbm : a DBM\n  \\param r : reference clocks for rdbm\n  \\param src_delay_allowed : set of reference clocks allowed to delay in source\n  state\n  \\param src_invariant : invariant in source state\n  \\param sync_ref_clocks : set of reference clocks to synchronize\n  \\param guard : transition guard\n  \\param clkreset : transition reset\n  \\param tgt_delay_allowed : set of reference clocks allowed to delay in target\n  state\n  \\param tgt_invariant : invariant in target state\n  \\pre rdbm is not nullptr (checked by assertion).\n  rdbm is a r.size()*r.size() array of difference bounds.\n  rdbm is not tight and consistent.\n  the size of src_delay_allowed is the number of reference clocks in r\n  (checked by assertion).\n  The size of sync_ref_clocks is the number of reference clocks in r (checked by\n  assertion).)\n  The size of tgt_delay_allowed is the number of reference clocks in r (checked\n  by assertion).\n  \\post rdbm has been intersected with src_invariant, then all reference clocks\n  in sync_ref_clocks have been synchronized in rdbm, then rdbm has been\n  intersected with guard, then rdbm has been reset w.r.t clkreset, then\n  intersected with tgt_invariant, then rdbm has been delayed (only reference\n  clocks that are allowed in tgt_delay_allowed) and intersected wth\n  tgt_invariant again\n  \\return tchecker::STATE_OK if the resulting DBM is not empty. Otherwise,\n  tchecker::STATE_CLOCKS_SRC_INVARIANT_VIOLATED if intersection with src_invariant\n  result in an empty zone, tchecker::STATE_CLOCKS_EMPTY_SYNC if synchronization\n  of reference clocks in sync_ref_clocks yields an empty zone,\n  tchecker::STATE_CLOCKS_GUARD_VIOLATED if intersection with guard result in an\n  empty zone, tchecker::STATE_EMPTY_SYNC if synchronization of reference clocks\n  result in an empty zone, tchecker::STATE_CLOCKS_TGT_INVARIANT_VIOLATED if\n  intersection with tgt_invariant result in an empty zone\n  */\n  virtual tchecker::state_status_t\n  next(tchecker::dbm::db_t * rdbm, tchecker::reference_clock_variables_t const & r,\n       boost::dynamic_bitset<> const & src_delay_allowed, tchecker::clock_constraint_container_t const & src_invariant,\n       boost::dynamic_bitset<> const & sync_ref_clocks, tchecker::clock_constraint_container_t const & guard,\n       tchecker::clock_reset_container_t const & clkreset, boost::dynamic_bitset<> const & tgt_delay_allowed,\n       tchecker::clock_constraint_container_t const & tgt_invariant);\n};\n\n/*!\n \\brief type of semantics\n*/\nenum semantics_type_t {\n  STANDARD_SEMANTICS, /*!< see tchecker::refzg::standard_semantics_t */\n  ELAPSED_SEMANTICS,  /*!< see tchecker::refzg::elapsed_semantics_t */\n};\n\n/*!\n \\brief Zone semantics factory\n \\param semantics_type : type zone graph semantics\n \\return A zone semantics over DBMs with reference clocks of type semantics\n \\note the returned semantics must be deallocated by the caller\n \\throw std::invalid_argument : if semantics is unknown\n*/\ntchecker::refzg::semantics_t * semantics_factory(enum tchecker::refzg::semantics_type_t semantics_type);\n\n} // end of namespace refzg\n\n} // end of namespace tchecker\n\n#endif // TCHECKER_REFZG_SEMANTICS_HH\n", "meta": {"hexsha": "b14ea7df7dd71c7c29f51fc3d6c496750d96af8c", "size": 11836, "ext": "hh", "lang": "C++", "max_stars_repo_path": "include/tchecker/refzg/semantics.hh", "max_stars_repo_name": "mukherjee-sayan/tchecker", "max_stars_repo_head_hexsha": "c4f37a479a7273c15fc45ccb9741984e72036f2e", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "include/tchecker/refzg/semantics.hh", "max_issues_repo_name": "mukherjee-sayan/tchecker", "max_issues_repo_head_hexsha": "c4f37a479a7273c15fc45ccb9741984e72036f2e", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "include/tchecker/refzg/semantics.hh", "max_forks_repo_name": "mukherjee-sayan/tchecker", "max_forks_repo_head_hexsha": "c4f37a479a7273c15fc45ccb9741984e72036f2e", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1.0, "max_forks_repo_forks_event_min_datetime": "2022-03-11T10:01:27.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-11T10:01:27.000Z", "avg_line_length": 44.6641509434, "max_line_length": 119, "alphanum_fraction": 0.7550692802, "num_tokens": 2876, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO\n\n", "lm_q1_score": 0.5544704649604273, "lm_q2_score": 0.26588047891687405, "lm_q1q2_score": 0.14742287276894023}}
{"text": "// Boost.Geometry - gis-projections (based on PROJ4)\r\n\r\n// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.\r\n\r\n// This file was modified by Oracle on 2017, 2018.\r\n// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.\r\n// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.\r\n\r\n// Use, modification and distribution is subject to the Boost Software License,\r\n// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at\r\n// http://www.boost.org/LICENSE_1_0.txt)\r\n\r\n// This file is converted from PROJ4, http://trac.osgeo.org/proj\r\n// PROJ4 is originally written by Gerald Evenden (then of the USGS)\r\n// PROJ4 is maintained by Frank Warmerdam\r\n// PROJ4 is converted to Boost.Geometry by Barend Gehrels\r\n\r\n// Last updated version of proj: 5.0.0\r\n\r\n// Original copyright notice:\r\n\r\n// Permission is hereby granted, free of charge, to any person obtaining a\r\n// copy of this software and associated documentation files (the \"Software\"),\r\n// to deal in the Software without restriction, including without limitation\r\n// the rights to use, copy, modify, merge, publish, distribute, sublicense,\r\n// and/or sell copies of the Software, and to permit persons to whom the\r\n// Software is furnished to do so, subject to the following conditions:\r\n\r\n// The above copyright notice and this permission notice shall be included\r\n// in all copies or substantial portions of the Software.\r\n\r\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\r\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\r\n// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\r\n// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\r\n// DEALINGS IN THE SOFTWARE.\r\n\r\n#ifndef BOOST_GEOMETRY_PROJECTIONS_IGH_HPP\r\n#define BOOST_GEOMETRY_PROJECTIONS_IGH_HPP\r\n\r\n#include <boost/geometry/util/math.hpp>\r\n#include <boost/shared_ptr.hpp>\r\n\r\n#include <boost/geometry/srs/projections/impl/base_static.hpp>\r\n#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>\r\n#include <boost/geometry/srs/projections/impl/projects.hpp>\r\n#include <boost/geometry/srs/projections/impl/factory_entry.hpp>\r\n#include <boost/geometry/srs/projections/proj/gn_sinu.hpp>\r\n#include <boost/geometry/srs/projections/proj/moll.hpp>\r\n\r\nnamespace boost { namespace geometry\r\n{\r\n\r\nnamespace projections\r\n{\r\n    #ifndef DOXYGEN_NO_DETAIL\r\n    namespace detail { namespace igh\r\n    {\r\n            // TODO: consider replacing dynamically created projections\r\n            // with member objects\r\n            template <typename T, typename Parameters>\r\n            struct par_igh\r\n            {\r\n                boost::shared_ptr<base_v<T, Parameters> > pj[12];\r\n                T dy0;\r\n            };\r\n\r\n            /* 40d 44' 11.8\" [degrees] */\r\n            template <typename T>\r\n            inline T d4044118() { return (T(40) + T(44)/T(60.) + T(11.8)/T(3600.)) * geometry::math::d2r<T>(); }\r\n\r\n            template <typename T>\r\n            inline T d10() { return T(10) * geometry::math::d2r<T>(); }\r\n            template <typename T>\r\n            inline T d20() { return T(20) * geometry::math::d2r<T>(); }\r\n            template <typename T>\r\n            inline T d30() { return T(30) * geometry::math::d2r<T>(); }\r\n            template <typename T>\r\n            inline T d40() { return T(40) * geometry::math::d2r<T>(); }\r\n            template <typename T>\r\n            inline T d50() { return T(50) * geometry::math::d2r<T>(); }\r\n            template <typename T>\r\n            inline T d60() { return T(60) * geometry::math::d2r<T>(); }\r\n            template <typename T>\r\n            inline T d80() { return T(80) * geometry::math::d2r<T>(); }\r\n            template <typename T>\r\n            inline T d90() { return T(90) * geometry::math::d2r<T>(); }\r\n            template <typename T>\r\n            inline T d100() { return T(100) * geometry::math::d2r<T>(); }\r\n            template <typename T>\r\n            inline T d140() { return T(140) * geometry::math::d2r<T>(); }\r\n            template <typename T>\r\n            inline T d160() { return T(160) * geometry::math::d2r<T>(); }\r\n            template <typename T>\r\n            inline T d180() { return T(180) * geometry::math::d2r<T>(); }\r\n\r\n            static const double epsilon = 1.e-10; // allow a little 'slack' on zone edge positions\r\n\r\n            // Converted from #define SETUP(n, proj, x_0, y_0, lon_0)\r\n            template <template <typename, typename, typename> class Entry, typename Params, typename Parameters, typename T>\r\n            inline void do_setup(int n, Params const& params, Parameters const& par, par_igh<T, Parameters>& proj_parm,\r\n                                 T const& x_0, T const& y_0,\r\n                                 T const& lon_0)\r\n            {\r\n                // NOTE: in the original proj4 these projections are initialized\r\n                // with zeroed parameters which could be done here as well instead\r\n                // of initializing with parent projection's parameters.\r\n                Entry<Params, T, Parameters> entry;\r\n                proj_parm.pj[n-1].reset(entry.create_new(params, par));\r\n                proj_parm.pj[n-1]->mutable_params().x0 = x_0;\r\n                proj_parm.pj[n-1]->mutable_params().y0 = y_0;\r\n                proj_parm.pj[n-1]->mutable_params().lam0 = lon_0;\r\n            }\r\n\r\n            // template class, using CRTP to implement forward/inverse\r\n            template <typename T, typename Parameters>\r\n            struct base_igh_spheroid\r\n                : public base_t_fi<base_igh_spheroid<T, Parameters>, T, Parameters>\r\n            {\r\n                par_igh<T, Parameters> m_proj_parm;\r\n\r\n                inline base_igh_spheroid(const Parameters& par)\r\n                    : base_t_fi<base_igh_spheroid<T, Parameters>, T, Parameters>(*this, par)\r\n                {}\r\n\r\n                // FORWARD(s_forward)  spheroid\r\n                // Project coordinates from geographic (lon, lat) to cartesian (x, y)\r\n                inline void fwd(T lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const\r\n                {\r\n                    static const T d4044118 = igh::d4044118<T>();\r\n                    static const T d20  =  igh::d20<T>();\r\n                    static const T d40  =  igh::d40<T>();\r\n                    static const T d80  =  igh::d80<T>();\r\n                    static const T d100 = igh::d100<T>();\r\n\r\n                        int z;\r\n                        if (lp_lat >=  d4044118) {          // 1|2\r\n                          z = (lp_lon <= -d40 ? 1: 2);\r\n                        }\r\n                        else if (lp_lat >=  0) {            // 3|4\r\n                          z = (lp_lon <= -d40 ? 3: 4);\r\n                        }\r\n                        else if (lp_lat >= -d4044118) {     // 5|6|7|8\r\n                               if (lp_lon <= -d100) z =  5; // 5\r\n                          else if (lp_lon <=  -d20) z =  6; // 6\r\n                          else if (lp_lon <=   d80) z =  7; // 7\r\n                          else z = 8;                       // 8\r\n                        }\r\n                        else {                              // 9|10|11|12\r\n                               if (lp_lon <= -d100) z =  9; // 9\r\n                          else if (lp_lon <=  -d20) z = 10; // 10\r\n                          else if (lp_lon <=   d80) z = 11; // 11\r\n                          else z = 12;                      // 12\r\n                        }\r\n\r\n                        lp_lon -= this->m_proj_parm.pj[z-1]->params().lam0;\r\n                        this->m_proj_parm.pj[z-1]->fwd(lp_lon, lp_lat, xy_x, xy_y);\r\n                        xy_x += this->m_proj_parm.pj[z-1]->params().x0;\r\n                        xy_y += this->m_proj_parm.pj[z-1]->params().y0;\r\n                }\r\n\r\n                // INVERSE(s_inverse)  spheroid\r\n                // Project coordinates from cartesian (x, y) to geographic (lon, lat)\r\n                inline void inv(T xy_x, T xy_y, T& lp_lon, T& lp_lat) const\r\n                {\r\n                    static const T d4044118 = igh::d4044118<T>();\r\n                    static const T d10  =  igh::d10<T>();\r\n                    static const T d20  =  igh::d20<T>();\r\n                    static const T d40  =  igh::d40<T>();\r\n                    static const T d50  =  igh::d50<T>();\r\n                    static const T d60  =  igh::d60<T>();\r\n                    static const T d80  =  igh::d80<T>();\r\n                    static const T d90  =  igh::d90<T>();\r\n                    static const T d100 = igh::d100<T>();\r\n                    static const T d160 = igh::d160<T>();\r\n                    static const T d180 = igh::d180<T>();\r\n\r\n                    static const T c2 = 2.0;\r\n                    \r\n                    const T y90 = this->m_proj_parm.dy0 + sqrt(c2); // lt=90 corresponds to y=y0+sqrt(2.0)\r\n\r\n                        int z = 0;\r\n                        if (xy_y > y90+epsilon || xy_y < -y90+epsilon) // 0\r\n                          z = 0;\r\n                        else if (xy_y >=  d4044118)       // 1|2\r\n                          z = (xy_x <= -d40? 1: 2);\r\n                        else if (xy_y >=  0)              // 3|4\r\n                          z = (xy_x <= -d40? 3: 4);\r\n                        else if (xy_y >= -d4044118) {     // 5|6|7|8\r\n                               if (xy_x <= -d100) z =  5; // 5\r\n                          else if (xy_x <=  -d20) z =  6; // 6\r\n                          else if (xy_x <=   d80) z =  7; // 7\r\n                          else z = 8;                     // 8\r\n                        }\r\n                        else {                            // 9|10|11|12\r\n                               if (xy_x <= -d100) z =  9; // 9\r\n                          else if (xy_x <=  -d20) z = 10; // 10\r\n                          else if (xy_x <=   d80) z = 11; // 11\r\n                          else z = 12;                    // 12\r\n                        }\r\n\r\n                        if (z)\r\n                        {\r\n                          int ok = 0;\r\n\r\n                          xy_x -= this->m_proj_parm.pj[z-1]->params().x0;\r\n                          xy_y -= this->m_proj_parm.pj[z-1]->params().y0;\r\n                          this->m_proj_parm.pj[z-1]->inv(xy_x, xy_y, lp_lon, lp_lat);\r\n                          lp_lon += this->m_proj_parm.pj[z-1]->params().lam0;\r\n\r\n                          switch (z) {\r\n                            case  1: ok = (lp_lon >= -d180-epsilon && lp_lon <=  -d40+epsilon) ||\r\n                                         ((lp_lon >=  -d40-epsilon && lp_lon <=  -d10+epsilon) &&\r\n                                          (lp_lat >=   d60-epsilon && lp_lat <=   d90+epsilon)); break;\r\n                            case  2: ok = (lp_lon >=  -d40-epsilon && lp_lon <=  d180+epsilon) ||\r\n                                         ((lp_lon >= -d180-epsilon && lp_lon <= -d160+epsilon) &&\r\n                                          (lp_lat >=   d50-epsilon && lp_lat <=   d90+epsilon)) ||\r\n                                         ((lp_lon >=  -d50-epsilon && lp_lon <=  -d40+epsilon) &&\r\n                                          (lp_lat >=   d60-epsilon && lp_lat <=   d90+epsilon)); break;\r\n                            case  3: ok = (lp_lon >= -d180-epsilon && lp_lon <=  -d40+epsilon); break;\r\n                            case  4: ok = (lp_lon >=  -d40-epsilon && lp_lon <=  d180+epsilon); break;\r\n                            case  5: ok = (lp_lon >= -d180-epsilon && lp_lon <= -d100+epsilon); break;\r\n                            case  6: ok = (lp_lon >= -d100-epsilon && lp_lon <=  -d20+epsilon); break;\r\n                            case  7: ok = (lp_lon >=  -d20-epsilon && lp_lon <=   d80+epsilon); break;\r\n                            case  8: ok = (lp_lon >=   d80-epsilon && lp_lon <=  d180+epsilon); break;\r\n                            case  9: ok = (lp_lon >= -d180-epsilon && lp_lon <= -d100+epsilon); break;\r\n                            case 10: ok = (lp_lon >= -d100-epsilon && lp_lon <=  -d20+epsilon); break;\r\n                            case 11: ok = (lp_lon >=  -d20-epsilon && lp_lon <=   d80+epsilon); break;\r\n                            case 12: ok = (lp_lon >=   d80-epsilon && lp_lon <=  d180+epsilon); break;\r\n                          }\r\n\r\n                          z = (!ok? 0: z); // projectable?\r\n                        }\r\n                     // if (!z) pj_errno = -15; // invalid x or y\r\n                        if (!z) lp_lon = HUGE_VAL;\r\n                        if (!z) lp_lat = HUGE_VAL;\r\n                }\r\n\r\n                static inline std::string get_name()\r\n                {\r\n                    return \"igh_spheroid\";\r\n                }\r\n\r\n            };\r\n\r\n            // Interrupted Goode Homolosine\r\n            template <typename Params, typename Parameters, typename T>\r\n            inline void setup_igh(Params const& params, Parameters& par, par_igh<T, Parameters>& proj_parm)\r\n            {\r\n                static const T d0   =  0;\r\n                static const T d4044118 = igh::d4044118<T>();\r\n                static const T d20  =  igh::d20<T>();\r\n                static const T d30  =  igh::d30<T>();\r\n                static const T d60  =  igh::d60<T>();\r\n                static const T d100 = igh::d100<T>();\r\n                static const T d140 = igh::d140<T>();\r\n                static const T d160 = igh::d160<T>();\r\n\r\n            /*\r\n              Zones:\r\n\r\n                -180            -40                       180\r\n                  +--------------+-------------------------+    Zones 1,2,9,10,11 & 12:\r\n                  |1             |2                        |      Mollweide projection\r\n                  |              |                         |\r\n                  +--------------+-------------------------+    Zones 3,4,5,6,7 & 8:\r\n                  |3             |4                        |      Sinusoidal projection\r\n                  |              |                         |\r\n                0 +-------+------+-+-----------+-----------+\r\n                  |5      |6       |7          |8          |\r\n                  |       |        |           |           |\r\n                  +-------+--------+-----------+-----------+\r\n                  |9      |10      |11         |12         |\r\n                  |       |        |           |           |\r\n                  +-------+--------+-----------+-----------+\r\n                -180    -100      -20         80          180\r\n            */\r\n                \r\n                    T lp_lam = 0, lp_phi = d4044118;\r\n                    T xy1_x, xy1_y;\r\n                    T xy3_x, xy3_y;\r\n\r\n                    // IMPORTANT: Force spherical sinu projection\r\n                    // This is required because unlike in the original proj4 here\r\n                    // parameters are used to initialize underlying projections.\r\n                    // In the original code zeroed parameters are passed which\r\n                    // could be done here as well though.\r\n                    par.es = 0.;\r\n\r\n                    // sinusoidal zones\r\n                    do_setup<sinu_entry>(3, params, par, proj_parm, -d100, d0, -d100);\r\n                    do_setup<sinu_entry>(4, params, par, proj_parm,   d30, d0,   d30);\r\n                    do_setup<sinu_entry>(5, params, par, proj_parm, -d160, d0, -d160);\r\n                    do_setup<sinu_entry>(6, params, par, proj_parm,  -d60, d0,  -d60);\r\n                    do_setup<sinu_entry>(7, params, par, proj_parm,   d20, d0,   d20);\r\n                    do_setup<sinu_entry>(8, params, par, proj_parm,  d140, d0,  d140);\r\n\r\n                    // mollweide zones\r\n                    do_setup<moll_entry>(1, params, par, proj_parm, -d100, d0, -d100);\r\n\r\n                    // y0 ?\r\n                     proj_parm.pj[0]->fwd(lp_lam, lp_phi, xy1_x, xy1_y); // zone 1\r\n                     proj_parm.pj[2]->fwd(lp_lam, lp_phi, xy3_x, xy3_y); // zone 3\r\n                    // y0 + xy1_y = xy3_y for lt = 40d44'11.8\"\r\n                    proj_parm.dy0 = xy3_y - xy1_y;\r\n\r\n                    proj_parm.pj[0]->mutable_params().y0 = proj_parm.dy0;\r\n\r\n                    // mollweide zones (cont'd)\r\n                    do_setup<moll_entry>( 2, params, par, proj_parm,   d30,  proj_parm.dy0,   d30);\r\n                    do_setup<moll_entry>( 9, params, par, proj_parm, -d160, -proj_parm.dy0, -d160);\r\n                    do_setup<moll_entry>(10, params, par, proj_parm,  -d60, -proj_parm.dy0,  -d60);\r\n                    do_setup<moll_entry>(11, params, par, proj_parm,   d20, -proj_parm.dy0,   d20);\r\n                    do_setup<moll_entry>(12, params, par, proj_parm,  d140, -proj_parm.dy0,  d140);\r\n\r\n                    // Already done before\r\n                    //par.es = 0.;\r\n            }\r\n\r\n    }} // namespace detail::igh\r\n    #endif // doxygen\r\n\r\n    /*!\r\n        \\brief Interrupted Goode Homolosine projection\r\n        \\ingroup projections\r\n        \\tparam Geographic latlong point type\r\n        \\tparam Cartesian xy point type\r\n        \\tparam Parameters parameter type\r\n        \\par Projection characteristics\r\n         - Pseudocylindrical\r\n         - Spheroid\r\n        \\par Example\r\n        \\image html ex_igh.gif\r\n    */\r\n    template <typename T, typename Parameters>\r\n    struct igh_spheroid : public detail::igh::base_igh_spheroid<T, Parameters>\r\n    {\r\n        template <typename Params>\r\n        inline igh_spheroid(Params const& params, Parameters const& par)\r\n            : detail::igh::base_igh_spheroid<T, Parameters>(par)\r\n        {\r\n            detail::igh::setup_igh(params, this->m_par, this->m_proj_parm);\r\n        }\r\n    };\r\n\r\n    #ifndef DOXYGEN_NO_DETAIL\r\n    namespace detail\r\n    {\r\n\r\n        // Static projection\r\n        BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_igh, igh_spheroid, igh_spheroid)\r\n\r\n        // Factory entry(s)\r\n        BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(igh_entry, igh_spheroid)\r\n\r\n        BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(igh_init)\r\n        {\r\n            BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(igh, igh_entry)\r\n        }\r\n\r\n    } // namespace detail\r\n    #endif // doxygen\r\n\r\n} // namespace projections\r\n\r\n}} // namespace boost::geometry\r\n\r\n#endif // BOOST_GEOMETRY_PROJECTIONS_IGH_HPP\r\n\r\n", "meta": {"hexsha": "c1c07c9e95b456ade77493a6ab111124bf017bb8", "size": 18522, "ext": "hpp", "lang": "C++", "max_stars_repo_path": "externals/boost/boost/geometry/srs/projections/proj/igh.hpp", "max_stars_repo_name": "YuukiTsuchida/v8_embeded", "max_stars_repo_head_hexsha": "c6e18f4e91fcc50607f8e3edc745a3afa30b2871", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 995.0, "max_stars_repo_stars_event_min_datetime": "2018-06-22T10:39:18.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-25T01:22:14.000Z", "max_issues_repo_path": "externals/boost/boost/geometry/srs/projections/proj/igh.hpp", "max_issues_repo_name": "YuukiTsuchida/v8_embeded", "max_issues_repo_head_hexsha": "c6e18f4e91fcc50607f8e3edc745a3afa30b2871", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 32.0, "max_issues_repo_issues_event_min_datetime": "2018-06-23T14:19:37.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-29T10:20:37.000Z", "max_forks_repo_path": "externals/boost/boost/geometry/srs/projections/proj/igh.hpp", "max_forks_repo_name": "YuukiTsuchida/v8_embeded", "max_forks_repo_head_hexsha": "c6e18f4e91fcc50607f8e3edc745a3afa30b2871", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 172.0, "max_forks_repo_forks_event_min_datetime": "2018-06-22T11:12:00.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-29T07:44:33.000Z", "avg_line_length": 49.7903225806, "max_line_length": 125, "alphanum_fraction": 0.4636108412, "num_tokens": 4519, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO", "lm_q1_score": 0.5736784074525096, "lm_q2_score": 0.25683199138751883, "lm_q1q2_score": 0.14733896780204847}}
{"text": "#ifndef BOOST_GEOMETRY_PROJECTIONS_LCC_HPP\n#define BOOST_GEOMETRY_PROJECTIONS_LCC_HPP\n\n// Boost.Geometry - extensions-gis-projections (based on PROJ4)\n// This file is automatically generated. DO NOT EDIT.\n\n// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.\n\n// This file was modified by Oracle on 2017.\n// Modifications copyright (c) 2017, Oracle and/or its affiliates.\n// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.\n\n// Use, modification and distribution is subject to the Boost Software License,\n// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at\n// http://www.boost.org/LICENSE_1_0.txt)\n\n// This file is converted from PROJ4, http://trac.osgeo.org/proj\n// PROJ4 is originally written by Gerald Evenden (then of the USGS)\n// PROJ4 is maintained by Frank Warmerdam\n// PROJ4 is converted to Boost.Geometry by Barend Gehrels\n\n// Last updated version of proj: 4.9.1\n\n// Original copyright notice:\n\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the \"Software\"),\n// to deal in the Software without restriction, including without limitation\n// the rights to use, copy, modify, merge, publish, distribute, sublicense,\n// and/or sell copies of the Software, and to permit persons to whom the\n// Software is furnished to do so, subject to the following conditions:\n\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n// DEALINGS IN THE SOFTWARE.\n\n#include <boost/geometry/util/math.hpp>\n#include <boost/math/special_functions/hypot.hpp>\n\n#include <boost/geometry/srs/projections/impl/base_static.hpp>\n#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>\n#include <boost/geometry/srs/projections/impl/projects.hpp>\n#include <boost/geometry/srs/projections/impl/factory_entry.hpp>\n#include <boost/geometry/srs/projections/impl/pj_msfn.hpp>\n#include <boost/geometry/srs/projections/impl/pj_phi2.hpp>\n#include <boost/geometry/srs/projections/impl/pj_tsfn.hpp>\n\n\nnamespace boost { namespace geometry\n{\n\nnamespace srs { namespace par4\n{\n    struct lcc {};\n\n}} //namespace srs::par4\n\nnamespace projections\n{\n    #ifndef DOXYGEN_NO_DETAIL\n    namespace detail { namespace lcc\n    {\n            static const double EPS10 = 1.e-10;\n\n            template <typename T>\n            struct par_lcc\n            {\n                T   phi1;\n                T   phi2;\n                T   n;\n                T   rho0;\n                T   c;\n                int ellips;\n            };\n\n            // template class, using CRTP to implement forward/inverse\n            template <typename CalculationType, typename Parameters>\n            struct base_lcc_ellipsoid : public base_t_fi<base_lcc_ellipsoid<CalculationType, Parameters>,\n                     CalculationType, Parameters>\n            {\n\n                typedef CalculationType geographic_type;\n                typedef CalculationType cartesian_type;\n\n                par_lcc<CalculationType> m_proj_parm;\n\n                inline base_lcc_ellipsoid(const Parameters& par)\n                    : base_t_fi<base_lcc_ellipsoid<CalculationType, Parameters>,\n                     CalculationType, Parameters>(*this, par) {}\n\n                // FORWARD(e_forward)  ellipsoid & spheroid\n                // Project coordinates from geographic (lon, lat) to cartesian (x, y)\n                inline void fwd(geographic_type& lp_lon, geographic_type& lp_lat, cartesian_type& xy_x, cartesian_type& xy_y) const\n                {\n                    static const CalculationType FORTPI = detail::FORTPI<CalculationType>();\n                    static const CalculationType HALFPI = detail::HALFPI<CalculationType>();\n\n                    CalculationType rho;\n                    if (fabs(fabs(lp_lat) - HALFPI) < EPS10) {\n                        if ((lp_lat * this->m_proj_parm.n) <= 0.)\n                            BOOST_THROW_EXCEPTION( projection_exception(-20) );\n                        rho = 0.;\n                    } else\n                        rho = this->m_proj_parm.c * (this->m_proj_parm.ellips ? pow(pj_tsfn(lp_lat, sin(lp_lat),\n                            this->m_par.e), this->m_proj_parm.n) : pow(tan(FORTPI + .5 * lp_lat), -this->m_proj_parm.n));\n                    xy_x = this->m_par.k0 * (rho * sin( lp_lon *= this->m_proj_parm.n ) );\n                    xy_y = this->m_par.k0 * (this->m_proj_parm.rho0 - rho * cos(lp_lon) );\n                }\n\n                // INVERSE(e_inverse)  ellipsoid & spheroid\n                // Project coordinates from cartesian (x, y) to geographic (lon, lat)\n                inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const\n                {\n                    static const CalculationType HALFPI = detail::HALFPI<CalculationType>();\n\n                    CalculationType rho;\n                    xy_x /= this->m_par.k0;\n                    xy_y /= this->m_par.k0;\n                    if( (rho = boost::math::hypot(xy_x, xy_y = this->m_proj_parm.rho0 - xy_y)) != 0.0) {\n                        if (this->m_proj_parm.n < 0.) {\n                            rho = -rho;\n                            xy_x = -xy_x;\n                            xy_y = -xy_y;\n                        }\n                        if (this->m_proj_parm.ellips) {\n                            if ((lp_lat = pj_phi2(pow(rho / this->m_proj_parm.c, 1./this->m_proj_parm.n), this->m_par.e))\n                                == HUGE_VAL)\n                                BOOST_THROW_EXCEPTION( projection_exception(-20) );\n                        } else\n                            lp_lat = 2. * atan(pow(this->m_proj_parm.c / rho, 1./this->m_proj_parm.n)) - HALFPI;\n                        lp_lon = atan2(xy_x, xy_y) / this->m_proj_parm.n;\n                    } else {\n                        lp_lon = 0.;\n                        lp_lat = this->m_proj_parm.n > 0. ? HALFPI : -HALFPI;\n                    }\n                }\n\n                // SPECIAL(fac)\n                #ifdef SPECIAL_FACTORS_NOT_CONVERTED\n                inline void fac(Geographic lp, Factors &fac) const\n                {\n                    static const CalculationType FORTPI = detail::FORTPI<CalculationType>();\n                    static const CalculationType HALFPI = detail::HALFPI<CalculationType>();\n\n                    CalculationType rho;\n                    if (fabs(fabs(lp_lat) - HALFPI) < EPS10) {\n                        if ((lp_lat * this->m_proj_parm.n) <= 0.) return;\n                        rho = 0.;\n                    } else\n                        rho = this->m_proj_parm.c * (this->m_proj_parm.ellips ? pow(pj_tsfn(lp_lat, sin(lp_lat),\n                            this->m_par.e), this->m_proj_parm.n) : pow(tan(FORTPI + .5 * lp_lat), -this->m_proj_parm.n));\n                    this->m_fac.code |= IS_ANAL_HK + IS_ANAL_CONV;\n                    this->m_fac.k = this->m_fac.h = this->m_par.k0 * this->m_proj_parm.n * rho /\n                        pj_msfn(sin(lp_lat), cos(lp_lat), this->m_par.es);\n                    this->m_fac.conv = - this->m_proj_parm.n * lp_lon;\n                }\n                #endif\n\n                static inline std::string get_name()\n                {\n                    return \"lcc_ellipsoid\";\n                }\n\n            };\n\n            // Lambert Conformal Conic\n            template <typename Parameters, typename T>\n            inline void setup_lcc(Parameters& par, par_lcc<T>& proj_parm)\n            {\n                static const T FORTPI = detail::FORTPI<T>();\n                static const T HALFPI = detail::HALFPI<T>();\n\n                T cosphi, sinphi;\n                int secant;\n\n                proj_parm.phi1 = pj_param(par.params, \"rlat_1\").f;\n                if (pj_param(par.params, \"tlat_2\").i)\n                    proj_parm.phi2 = pj_param(par.params, \"rlat_2\").f;\n                else {\n                    proj_parm.phi2 = proj_parm.phi1;\n                    if (!pj_param(par.params, \"tlat_0\").i)\n                        par.phi0 = proj_parm.phi1;\n                }\n                if (fabs(proj_parm.phi1 + proj_parm.phi2) < EPS10)\n                    BOOST_THROW_EXCEPTION( projection_exception(-21) );\n                proj_parm.n = sinphi = sin(proj_parm.phi1);\n                cosphi = cos(proj_parm.phi1);\n                secant = fabs(proj_parm.phi1 - proj_parm.phi2) >= EPS10;\n                if( (proj_parm.ellips = (par.es != 0.)) ) {\n                    double ml1, m1;\n\n                    par.e = sqrt(par.es);\n                    m1 = pj_msfn(sinphi, cosphi, par.es);\n                    ml1 = pj_tsfn(proj_parm.phi1, sinphi, par.e);\n                    if (secant) { /* secant cone */\n                        proj_parm.n = log(m1 /\n                           pj_msfn(sinphi = sin(proj_parm.phi2), cos(proj_parm.phi2), par.es));\n                        proj_parm.n /= log(ml1 / pj_tsfn(proj_parm.phi2, sinphi, par.e));\n                    }\n                    proj_parm.c = (proj_parm.rho0 = m1 * pow(ml1, -proj_parm.n) / proj_parm.n);\n                    proj_parm.rho0 *= (fabs(fabs(par.phi0) - HALFPI) < EPS10) ? 0. :\n                        pow(pj_tsfn(par.phi0, sin(par.phi0), par.e), proj_parm.n);\n                } else {\n                    if (secant)\n                        proj_parm.n = log(cosphi / cos(proj_parm.phi2)) /\n                           log(tan(FORTPI + .5 * proj_parm.phi2) /\n                           tan(FORTPI + .5 * proj_parm.phi1));\n                    proj_parm.c = cosphi * pow(tan(FORTPI + .5 * proj_parm.phi1), proj_parm.n) / proj_parm.n;\n                    proj_parm.rho0 = (fabs(fabs(par.phi0) - HALFPI) < EPS10) ? 0. :\n                        proj_parm.c * pow(tan(FORTPI + .5 * par.phi0), -proj_parm.n);\n                }\n            }\n\n    }} // namespace detail::lcc\n    #endif // doxygen\n\n    /*!\n        \\brief Lambert Conformal Conic projection\n        \\ingroup projections\n        \\tparam Geographic latlong point type\n        \\tparam Cartesian xy point type\n        \\tparam Parameters parameter type\n        \\par Projection characteristics\n         - Conic\n         - Spheroid\n         - Ellipsoid\n        \\par Projection parameters\n         - lat_1: Latitude of first standard parallel (degrees)\n         - lat_2: Latitude of second standard parallel (degrees)\n         - lat_0: Latitude of origin\n        \\par Example\n        \\image html ex_lcc.gif\n    */\n    template <typename CalculationType, typename Parameters>\n    struct lcc_ellipsoid : public detail::lcc::base_lcc_ellipsoid<CalculationType, Parameters>\n    {\n        inline lcc_ellipsoid(const Parameters& par) : detail::lcc::base_lcc_ellipsoid<CalculationType, Parameters>(par)\n        {\n            detail::lcc::setup_lcc(this->m_par, this->m_proj_parm);\n        }\n    };\n\n    #ifndef DOXYGEN_NO_DETAIL\n    namespace detail\n    {\n\n        // Static projection\n        BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::lcc, lcc_ellipsoid, lcc_ellipsoid)\n\n        // Factory entry(s)\n        template <typename CalculationType, typename Parameters>\n        class lcc_entry : public detail::factory_entry<CalculationType, Parameters>\n        {\n            public :\n                virtual base_v<CalculationType, Parameters>* create_new(const Parameters& par) const\n                {\n                    return new base_v_fi<lcc_ellipsoid<CalculationType, Parameters>, CalculationType, Parameters>(par);\n                }\n        };\n\n        template <typename CalculationType, typename Parameters>\n        inline void lcc_init(detail::base_factory<CalculationType, Parameters>& factory)\n        {\n            factory.add_to_factory(\"lcc\", new lcc_entry<CalculationType, Parameters>);\n        }\n\n    } // namespace detail\n    #endif // doxygen\n\n} // namespace projections\n\n}} // namespace boost::geometry\n\n#endif // BOOST_GEOMETRY_PROJECTIONS_LCC_HPP\n\n", "meta": {"hexsha": "609c08491c97b64489f9b4f50bb87c2e4776dc8c", "size": 12435, "ext": "hpp", "lang": "C++", "max_stars_repo_path": "boost_1_67_0/boost/geometry/srs/projections/proj/lcc.hpp", "max_stars_repo_name": "ramcn/gemmx", "max_stars_repo_head_hexsha": "e23ab5358322a293110b642962b478bc92580636", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 354.0, "max_stars_repo_stars_event_min_datetime": "2018-08-13T18:19:21.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-20T10:37:20.000Z", "max_issues_repo_path": "boost_1_67_0/boost/geometry/srs/projections/proj/lcc.hpp", "max_issues_repo_name": "ramcn/gemmx", "max_issues_repo_head_hexsha": "e23ab5358322a293110b642962b478bc92580636", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 79.0, "max_issues_repo_issues_event_min_datetime": "2018-08-01T11:50:45.000Z", "max_issues_repo_issues_event_max_datetime": "2020-11-17T13:40:06.000Z", "max_forks_repo_path": "boost_1_67_0/boost/geometry/srs/projections/proj/lcc.hpp", "max_forks_repo_name": "ramcn/gemmx", "max_forks_repo_head_hexsha": "e23ab5358322a293110b642962b478bc92580636", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 90.0, "max_forks_repo_forks_event_min_datetime": "2018-11-15T12:37:51.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-14T11:12:39.000Z", "avg_line_length": 43.9399293286, "max_line_length": 131, "alphanum_fraction": 0.5684760756, "num_tokens": 2856, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO", "lm_q1_score": 0.5195213070736461, "lm_q2_score": 0.2782567937024021, "lm_q1q2_score": 0.14456033316639383}}
{"text": "//---------------------------------------------------------------------------//\n// Copyright (c) 2018-2020 Mikhail Komarov <nemo@nil.foundation>\n// Copyright (c) 2020 Nikita Kaskov <nbering@nil.foundation>\n//\n// MIT License\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n//---------------------------------------------------------------------------//\n\n#include <boost/program_options.hpp>\n\n#include <nil/crypto3/zk/snark/default_types/ram_zksnark_pp.hpp>\n#include <nil/crypto3/zk/snark/relations/ram_computations/memory/examples/memory_contents_examples.hpp>\n#include <nil/crypto3/zk/snark/relations/ram_computations/rams/examples/ram_examples.hpp>\n#include <nil/crypto3/zk/snark/relations/ram_computations/rams/tinyram/tinyram_params.hpp>\n#include <nil/crypto3/zk/snark/schemes/zksnark/ram_zksnark/examples/run_ram_zksnark.hpp>\n#include <nil/crypto3/zk/snark/schemes/zksnark/ram_zksnark/ram_zksnark.hpp>\n\nusing namespace nil::crypto3::zk::snark;\n\ntemplate<typename FieldType>\nvoid simulate_random_memory_contents(const tinyram_architecture_params &ap, const std::size_t input_size,\n                                     const std::size_t program_size) {\n    const std::size_t num_addresses = 1ul << ap.dwaddr_len();\n    const std::size_t value_size = 2 * ap.w;\n    memory_contents init_random =\n        random_memory_contents(num_addresses, value_size, program_size + (input_size + 1) / 2);\n\n    std::cout << \"Initialize random delegated memory\" << std::endl;\n    delegated_ra_memory<FieldType> dm_random(num_addresses, value_size, init_random);\n}\n\ntemplate<typename CurveType>\nvoid profile_ram_zksnark_verifier(const tinyram_architecture_params &ap, const std::size_t input_size,\n                                  const std::size_t program_size) {\n    typedef ram_zksnark_machine_pp<CurveType> RAMType;\n    const std::size_t time_bound = 10;\n\n    const std::size_t boot_trace_size_bound = program_size + input_size;\n    const ram_example<RAMType> example = gen_ram_example_complex<RAMType>(ap, boot_trace_size_bound, time_bound, true);\n\n    ram_zksnark_proof<CurveType> pi;\n    ram_zksnark_verification_key<CurveType> vk = ram_zksnark_verification_key<CurveType>::dummy_verification_key(ap);\n\n    std::cout << \"Verify fake proof\" << std::endl;\n    ram_zksnark_verifier<CurveType>(vk, example.boot_trace, time_bound, pi);\n}\n\ntemplate<typename CurveType>\nvoid print_ram_zksnark_verifier_profiling() {\n    algebra::inhibit_profiling_info = true;\n    for (std::size_t w : {16, 32}) {\n        const std::size_t k = 16;\n\n        for (std::size_t input_size : {0, 10, 100}) {\n            for (std::size_t program_size = 10; program_size <= 10000; program_size *= 10) {\n                const tinyram_architecture_params ap(w, k);\n\n                profile_ram_zksnark_verifier<CurveType>(ap, input_size, program_size);\n\n                const double input_map = algebra::last_times[\"Call to ram_zksnark_verifier_input_map\"];\n                const double preprocessing = algebra::last_times[\"Call to r1cs_ppzksnark_process_verification_key\"];\n                const double accumulate = algebra::last_times[\"Call to r1cs_ppzksnark_IC_query::accumulate\"];\n                const double pairings = algebra::last_times[\"Online pairing computations\"];\n                const double total = algebra::last_times[\"Call to ram_zksnark_verifier\"];\n                const double rest = total - (input_map + preprocessing + accumulate + pairings);\n\n                const double delegated_ra_memory_init =\n                    algebra::last_times[\"Construct delegated_ra_memory from memory map\"];\n                simulate_random_memory_contents<algebra::Fr<typename CurveType::curve_A_pp>>(ap, input_size,\n                                                                                             program_size);\n                const double delegated_ra_memory_init_random =\n                    algebra::last_times[\"Initialize random delegated memory\"];\n                const double input_map_random = input_map - delegated_ra_memory_init + delegated_ra_memory_init_random;\n                const double total_random = total - delegated_ra_memory_init + delegated_ra_memory_init_random;\n\n                printf(\n                    \"w = %zu, k = %zu, program_size = %zu, input_size = %zu, input_map = %0.2fms, preprocessing = \"\n                    \"%0.2fms, accumulate = %0.2fms, pairings = %0.2fms, rest = %0.2fms, total = %0.2fms \"\n                    \"(input_map_random = %0.2fms, total_random = %0.2fms)\\n\",\n                    w, k, program_size, input_size, input_map * 1e-6, preprocessing * 1e-6, accumulate * 1e-6,\n                    pairings * 1e-6, rest * 1e-6, total * 1e-6, input_map_random * 1e-6, total_random * 1e-6);\n            }\n        }\n    }\n}\n\ntemplate<typename CurveType>\nvoid profile_ram_zksnark(const tinyram_architecture_params &ap, const std::size_t program_size,\n                         const std::size_t input_size, const std::size_t time_bound) {\n    typedef ram_zksnark_machine_pp<CurveType> RAMType;\n\n    const std::size_t boot_trace_size_bound = program_size + input_size;\n    const ram_example<RAMType> example = gen_ram_example_complex<RAMType>(ap, boot_trace_size_bound, time_bound, true);\n    const bool bit = run_ram_zksnark<CurveType>(example);\n    assert(bit);\n}\n\nnamespace po = boost::program_options;\n\nbool process_command_line(const int argc, const char **argv, bool &profile_gp, std::size_t &w, std::size_t &k,\n                          bool &profile_v, std::size_t &l) {\n    try {\n        po::options_description desc(\"Usage\");\n        desc.add_options()(\"help\", \"print this help message\")(\"profile_gp\", \"profile generator and prover\")(\n            \"w\", po::value<std::size_t>(&w)->default_value(16), \"word size\")(\n            \"k\", po::value<std::size_t>(&k)->default_value(16), \"register count\")(\"profile_v\", \"profile verifier\")(\n            \"v\", \"print version info\")(\"l\", po::value<std::size_t>(&l)->default_value(10), \"program length\");\n\n        po::variables_map vm;\n        po::store(po::parse_command_line(argc, argv, desc), vm);\n\n        if (vm.count(\"v\")) {\n            algebra::print_compilation_info();\n            exit(0);\n        }\n\n        if (vm.count(\"help\")) {\n            std::cout << desc << \"\\n\";\n            return false;\n        }\n\n        profile_gp = vm.count(\"profile_gp\");\n        profile_v = vm.count(\"profile_v\");\n\n        if (!(vm.count(\"profile_gp\") ^ vm.count(\"profile_v\"))) {\n            std::cout << \"Must choose between profiling generator/prover and profiling verifier (see --help)\\n\";\n            return false;\n        }\n\n        po::notify(vm);\n    } catch (std::exception &e) {\n        std::cerr << \"Error: \" << e.what() << \"\\n\";\n        return false;\n    }\n\n    return true;\n}\n\nint main(int argc, const char *argv[]) {\n    bool profile_gp;\n    std::size_t w;\n    std::size_t k;\n    bool profile_v;\n    std::size_t l;\n\n    if (!process_command_line(argc, argv, profile_gp, w, k, profile_v, l)) {\n        return 1;\n    }\n\n    tinyram_architecture_params ap(w, k);\n\n    if (profile_gp) {\n        profile_ram_zksnark<default_ram_zksnark_pp>(ap, 100, 100, 10);    // w, k, l, n, T\n    }\n\n    if (profile_v) {\n        profile_ram_zksnark_verifier<default_ram_zksnark_pp>(ap, l / 2, l / 2);\n    }\n}\n", "meta": {"hexsha": "dc6b3b5d8bc9a84cdc52d655867b8642deb1aaf5", "size": 8279, "ext": "cpp", "lang": "C++", "max_stars_repo_path": "perf/proof_systems/zksnark/ram_zksnark/profile_ram_zksnark.cpp", "max_stars_repo_name": "NoamDev/crypto3-zk", "max_stars_repo_head_hexsha": "5f03e49b737994a3cecf673b029a4e32a2a8aaa5", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "perf/proof_systems/zksnark/ram_zksnark/profile_ram_zksnark.cpp", "max_issues_repo_name": "NoamDev/crypto3-zk", "max_issues_repo_head_hexsha": "5f03e49b737994a3cecf673b029a4e32a2a8aaa5", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "perf/proof_systems/zksnark/ram_zksnark/profile_ram_zksnark.cpp", "max_forks_repo_name": "NoamDev/crypto3-zk", "max_forks_repo_head_hexsha": "5f03e49b737994a3cecf673b029a4e32a2a8aaa5", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 46.7740112994, "max_line_length": 119, "alphanum_fraction": 0.6530982003, "num_tokens": 2011, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO\n\n", "lm_q1_score": 0.5078118642792044, "lm_q2_score": 0.2814056194821862, "lm_q1q2_score": 0.14290111224789337}}
{"text": "//---------------------------------------------------------------------------//\n//!\n//! \\file   MonteCarlo_StandardCompleteDopplerBroadenedPhotonEnergyDistribution_def.hpp\n//! \\author Alex Robinson\n//! \\brief  The complete Doppler broadened photon energy distribution def.\n//!\n//---------------------------------------------------------------------------//\n\n#ifndef MONTE_CARLO_STANDARD_COMPLETE_DOPPLER_BROADENED_PHOTON_ENERGY_DISTRIBUTION_DEF_HPP\n#define MONTE_CARLO_STANDARD_COMPLETE_DOPPLER_BROADENED_PHOTON_ENERGY_DISTRIBUTION_DEF_HPP\n\n// Boost Includes\n#include <boost/function.hpp>\n#include <boost/bind.hpp>\n\n// FRENSIE Includes\n#include \"MonteCarlo_PhotonKinematicsHelpers.hpp\"\n#include \"Utility_DiscreteDistribution.hpp\"\n#include \"Utility_GaussKronrodIntegrator.hpp\"\n#include \"Utility_RandomNumberGenerator.hpp\"\n#include \"Utility_ExplicitTemplateInstantiationMacros.hpp\"\n#include \"Utility_DesignByContract.hpp\"\n\nnamespace MonteCarlo{\n\n// Constructor\ntemplate<typename ComptonProfilePolicy>\nStandardCompleteDopplerBroadenedPhotonEnergyDistribution<ComptonProfilePolicy>::StandardCompleteDopplerBroadenedPhotonEnergyDistribution(\n\t\tconst std::vector<double>& endf_subshell_occupancies,\n                const std::vector<Data::SubshellType>& endf_subshell_order,\n                const std::shared_ptr<const ComptonProfileSubshellConverter>&\n                subshell_converter,\n                const ComptonProfileArray& electron_momentum_dist_array )\n  : d_endf_subshell_occupancy_distribution(),\n    d_endf_subshell_order(),\n    d_endf_subshell_occupancies( endf_subshell_occupancies ),\n    d_subshell_converter( subshell_converter ),\n    d_compton_profile_array( electron_momentum_dist_array )\n{\n  // Make sure the shell interaction data is valid\n  testPrecondition( endf_subshell_occupancies.size() > 0 );\n  testPrecondition( endf_subshell_order.size() ==\n\t\t    endf_subshell_occupancies.size() );\n  // Make sure that the subshell converter is valid\n  testPrecondition( subshell_converter.get() );\n  // Make sure the comptron profile array is valid\n  testPrecondition( electron_momentum_dist_array.size() > 0 );\n  testPrecondition( ComptonProfilePolicy::isValidProfile( *electron_momentum_dist_array.front() ) );\n  testPrecondition( ComptonProfilePolicy::isValidProfile( *electron_momentum_dist_array.back() ) );\n\n  // Create the ENDF subshell interaction distribution\n  std::vector<double> dummy_indep_vals( endf_subshell_occupancies.size() );\n\n  d_endf_subshell_occupancy_distribution.reset(\n\t      new Utility::DiscreteDistribution( dummy_indep_vals,\n\t\t\t\t\t\t endf_subshell_occupancies ) );\n\n  // Create the endf subshell order bimap\n  for( unsigned i = 0; i < endf_subshell_order.size(); ++i )\n  {\n    d_endf_subshell_order.insert( SubshellOrderMapType::value_type(\n                                                 i, endf_subshell_order[i] ) );\n  }\n}\n\n// Evaluate the distribution with the electron momentum projection\n/*! \\details The electron momentum projection must be in me*c units\n * (a momentum value of me*c kg*m/s is 1.0 in me*c units). The distribution\n * will have units of barns since the unitless momentum is being used.\n */\ntemplate<typename ComptonProfilePolicy>\ndouble StandardCompleteDopplerBroadenedPhotonEnergyDistribution<ComptonProfilePolicy>::evaluateWithElectronMomentumProjection(\n                                   const double incoming_energy,\n                                   const double electron_momentum_projection,\n                                   const double scattering_angle_cosine ) const\n{\n  // Make sure the incoming energy is valid\n  testPrecondition( incoming_energy > 0.0 );\n  // Make sure the electron momentum projection is valid\n  testPrecondition( electron_momentum_projection >= -1.0 );\n  // Make sure the scattering angle is valid\n  testPrecondition( scattering_angle_cosine >= -1.0 );\n  testPrecondition( scattering_angle_cosine <= 1.0 );\n\n  // The total double differential cross section\n  double cross_section = 0.0;\n\n  // Evaluate each subshell\n  SubshellOrderMapType::const_iterator subshell_it =\n    d_endf_subshell_order.begin();\n\n  while( subshell_it != d_endf_subshell_order.end() )\n  {\n    cross_section += this->evaluateSubshellWithElectronMomentumProjection(\n                                                  incoming_energy,\n                                                  electron_momentum_projection,\n                                                  scattering_angle_cosine,\n                                                  subshell_it->right );\n\n    ++subshell_it;\n  }\n\n  // Make sure the cross section is valid\n  testPrecondition( cross_section >= 0.0 );\n\n  return cross_section;\n}\n\n// Evaluate the exact distribution\n/*! \\details The distribution has units of barns/MeV.\n */\ntemplate<typename ComptonProfilePolicy>\ndouble StandardCompleteDopplerBroadenedPhotonEnergyDistribution<ComptonProfilePolicy>::evaluateExact(\n\t\t\t\t   const double incoming_energy,\n\t\t\t\t   const double outgoing_energy,\n\t\t\t\t   const double scattering_angle_cosine ) const\n{\n  // Make sure the incoming energy is valid\n  testPrecondition( incoming_energy > 0.0 );\n  // Make sure the outgoing energy is valid\n  testPrecondition( outgoing_energy <= incoming_energy );\n  testPrecondition( outgoing_energy >= 0.0 );\n  // Make sure the scattering angle is valid\n  testPrecondition( scattering_angle_cosine >= -1.0 );\n  testPrecondition( scattering_angle_cosine <= 1.0 );\n\n  // The total double differential cross section\n  double cross_section = 0.0;\n\n  // Evaluate each subshell\n  SubshellOrderMapType::const_iterator subshell_it =\n    d_endf_subshell_order.begin();\n\n  while( subshell_it != d_endf_subshell_order.end() )\n  {\n    cross_section += this->evaluateSubshellExact( incoming_energy,\n                                                  outgoing_energy,\n                                                  scattering_angle_cosine,\n                                                  subshell_it->right );\n\n    ++subshell_it;\n  }\n\n  // Make sure the cross section is valid\n  testPostcondition( cross_section >= 0.0 );\n\n  return cross_section;\n}\n\n// Evaluate the subshell distribution with the electron momentum projection\n/*! \\details The electron momentum projection must be in me*c units\n * (a momentum value of me*c kg*m/s is 1.0 in me*c units). The distribution\n * will have units of barns since the unitless momentum is being used.\n */\ntemplate<typename ComptonProfilePolicy>\ndouble StandardCompleteDopplerBroadenedPhotonEnergyDistribution<ComptonProfilePolicy>::evaluateSubshellWithElectronMomentumProjection(\n                                                                                                                     const double incoming_energy,\n                                     const double electron_momentum_projection,\n                                     const double scattering_angle_cosine,\n                                     const Data::SubshellType subshell ) const\n{\n  // Make sure the incoming energy is valid\n  testPrecondition( incoming_energy > 0.0 );\n  // Make sure the electron momentum projection is valid\n  testPrecondition( electron_momentum_projection >= -1.0 );\n  // Make sure the scattering angle is valid\n  testPrecondition( scattering_angle_cosine >= -1.0 );\n  testPrecondition( scattering_angle_cosine <= 1.0 );\n  // Make sure the subshell is valid\n  testPrecondition( this->isValidSubshell( subshell ) );\n\n  // Get the subshell binding energy\n  const double subshell_binding_energy =\n    this->getSubshellBindingEnergy( subshell );\n\n  // Calculate the max electron momentum projection\n  ComptonProfile::MomentumQuantity max_electron_momentum_projection =\n    calculateMaxElectronMomentumProjection( incoming_energy,\n                                            subshell_binding_energy,\n                                            scattering_angle_cosine )*\n    ComptonProfile::MomentumUnit();\n\n  // Get the subshell occupancy\n  const double subshell_occupancy =\n    this->getSubshellOccupancy( subshell );\n\n  // Get the Compton profile for the subshell\n  const ComptonProfile& compton_profile =\n    this->getComptonProfile( subshell );\n\n  // Evaluate the Compton profile\n  ComptonProfile::ProfileQuantity compton_profile_quantity =\n    ComptonProfilePolicy::evaluateWithPossibleLimit(\n                   compton_profile,\n                   electron_momentum_projection*ComptonProfile::MomentumUnit(),\n                   max_electron_momentum_projection );\n\n  // Evaluate the cross section\n  const double multiplier = this->evaluateMultiplier(incoming_energy,\n                                                     scattering_angle_cosine );\n\n  const double relativistic_term = this->evaluateRelativisticTerm(\n                                                     incoming_energy,\n                                                     scattering_angle_cosine );\n\n  const double cross_section = multiplier*relativistic_term*subshell_occupancy*\n    compton_profile_quantity.value();\n\n  // Make sure the cross section is valid\n  testPostcondition( cross_section >= 0.0 );\n\n  return cross_section;\n}\n\n// Evaluate the exact subshell distribution\n  /*! \\details The distribution has units of barns/MeV.\n */\ntemplate<typename ComptonProfilePolicy>\ndouble StandardCompleteDopplerBroadenedPhotonEnergyDistribution<ComptonProfilePolicy>::evaluateSubshellExact(\n\t\t\t\t      const double incoming_energy,\n                                      const double outgoing_energy,\n                                      const double scattering_angle_cosine,\n\t\t\t\t      const Data::SubshellType subshell ) const\n{\n  // Make sure the incoming energy is valid\n  testPrecondition( incoming_energy > 0.0 );\n  // Make sure the outgoing energy is valid\n  testPrecondition( outgoing_energy <= incoming_energy );\n  testPrecondition( outgoing_energy >= 0.0 );\n  // Make sure the scattering angle is valid\n  testPrecondition( scattering_angle_cosine >= -1.0 );\n  testPrecondition( scattering_angle_cosine <= 1.0 );\n  // Make sure the subshell is valid\n  testPrecondition( this->isValidSubshell( subshell ) );\n\n  // Get the subshell binding energy\n  const double subshell_binding_energy =\n    this->getSubshellBindingEnergy( subshell );\n\n  // The evaluated double differential cross section\n  double cross_section;\n\n  if( outgoing_energy <= incoming_energy - subshell_binding_energy )\n  {\n    // Get the Compton profile for the subshell\n    const ComptonProfile& compton_profile =\n      this->getComptonProfile( subshell );\n\n    // Get the subshell occupancy\n    const double subshell_occupancy = this->getSubshellOccupancy( subshell );\n\n    // Calculate the electron momentum projection\n    const ComptonProfile::MomentumQuantity electron_momentum_projection =\n      ComptonProfile::MomentumUnit()*\n      calculateElectronMomentumProjection( incoming_energy,\n                                           outgoing_energy,\n                                           scattering_angle_cosine);\n\n    // Evaluate the Compton profile\n    ComptonProfile::ProfileQuantity compton_profile_quantity =\n      ComptonProfilePolicy::evaluate( compton_profile,\n                                      electron_momentum_projection );\n\n    // Evaluate the cross section\n    const double multiplier = this->evaluateMultiplierExact(\n                                                     incoming_energy,\n                                                     outgoing_energy,\n                                                     scattering_angle_cosine );\n\n    const double relativistic_term = this->evaluateRelativisticTermExact(\n                                                     incoming_energy,\n                                                     outgoing_energy,\n                                                     scattering_angle_cosine );\n\n    cross_section = multiplier*relativistic_term*subshell_occupancy*\n      compton_profile_quantity.value();\n  }\n  else\n    cross_section = 0.0;\n\n  // Make sure the cross section is valid\n  testPostcondition( cross_section >= 0.0 );\n\n  return cross_section;\n}\n\n// Evaluate the PDF with the electron momentum projection\n/*! \\details The electron momentum projection must be in me*c units\n * (a momentum value of me*c kg*m/s is 1.0 in me*c units). The PDF\n * will be unitless since the unitless momentum is being used.\n */\ntemplate<typename ComptonProfilePolicy>\ndouble StandardCompleteDopplerBroadenedPhotonEnergyDistribution<ComptonProfilePolicy>::evaluatePDFWithElectronMomentumProjection(\n                                   const double incoming_energy,\n                                   const double electron_momentum_projection,\n                                   const double scattering_angle_cosine,\n                                   const double precision ) const\n{\n  // Make sure the precision is valid\n  testPrecondition( precision > 0.0 );\n  testPrecondition( precision < 1.0 );\n\n  const double diff_cross_section =\n    this->evaluateWithElectronMomentumProjection( incoming_energy,\n                                                  electron_momentum_projection,\n                                                  scattering_angle_cosine );\n  const double integrated_cross_section =\n    this->evaluateIntegratedCrossSection( incoming_energy,\n                                          scattering_angle_cosine,\n                                          precision );\n\n  if( integrated_cross_section > 0.0 )\n    return diff_cross_section/integrated_cross_section;\n  else\n    return 0.0;\n}\n\n// Evaluate the exact PDF\n/*! \\details The PDF has units of inverse MeV.\n */\ntemplate<typename ComptonProfilePolicy>\ndouble StandardCompleteDopplerBroadenedPhotonEnergyDistribution<ComptonProfilePolicy>::evaluatePDFExact(\n\t\t\t\t   const double incoming_energy,\n\t\t\t\t   const double outgoing_energy,\n\t\t\t\t   const double scattering_angle_cosine,\n                                   const double precision ) const\n{\n  // Make sure the precision is valid\n  testPrecondition( precision > 0.0 );\n  testPrecondition( precision < 1.0 );\n\n  const double diff_cross_section = this->evaluateExact(\n                                                     incoming_energy,\n                                                     outgoing_energy,\n                                                     scattering_angle_cosine );\n\n  const double integrated_cross_section =\n    this->evaluateIntegratedCrossSectionExact( incoming_energy,\n                                               scattering_angle_cosine,\n                                               precision );\n\n  if( integrated_cross_section > 0.0 )\n    return diff_cross_section/integrated_cross_section;\n  else\n    return 0.0;\n}\n\n// Evaluate the subshell PDF with the electron momentum projection\n/*! \\details The electron momentum projection must be in me*c units\n * (a momentum value of me*c kg*m/s is 1.0 in me*c units). The PDF\n * will be unitless since the unitless momentum is being used.\n */\ntemplate<typename ComptonProfilePolicy>\ndouble StandardCompleteDopplerBroadenedPhotonEnergyDistribution<ComptonProfilePolicy>::evaluateSubshellPDFWithElectronMomentumProjection(\n                                 const double incoming_energy,\n                                 const double electron_momentum_projection,\n                                 const double scattering_angle_cosine,\n                                 const Data::SubshellType subshell,\n                                 const double precision ) const\n{\n  // Make sure the precision is valid\n  testPrecondition( precision > 0.0 );\n  testPrecondition( precision < 1.0 );\n\n  const double diff_cross_section =\n    this->evaluateSubshellWithElectronMomentumProjection(\n                                                  incoming_energy,\n                                                  electron_momentum_projection,\n                                                  scattering_angle_cosine,\n                                                  subshell );\n\n  const double integrated_cross_section =\n    this->evaluateSubshellIntegratedCrossSection( incoming_energy,\n                                                  scattering_angle_cosine,\n                                                  subshell,\n                                                  precision );\n\n  if( integrated_cross_section > 0.0 )\n    return diff_cross_section/integrated_cross_section;\n  else\n    return 0.0;\n}\n\n// Evaluate the exact subshell PDF\n/*! \\details The PDF has units of inverse MeV.\n */\ntemplate<typename ComptonProfilePolicy>\ndouble StandardCompleteDopplerBroadenedPhotonEnergyDistribution<ComptonProfilePolicy>::evaluateSubshellPDFExact(\n\t\t\t\t\t  const double incoming_energy,\n\t\t\t\t\t  const double outgoing_energy,\n\t\t\t\t          const double scattering_angle_cosine,\n\t\t\t\t\t  const Data::SubshellType subshell,\n                                          const double precision ) const\n{\n  // Make sure the precision is valid\n  testPrecondition( precision > 0.0 );\n  testPrecondition( precision < 1.0 );\n\n  const double diff_cross_section =\n    this->evaluateSubshellExact( incoming_energy,\n                                 outgoing_energy,\n                                 scattering_angle_cosine,\n                                 subshell );\n\n  const double integrated_cross_section =\n    this->evaluateSubshellIntegratedCrossSectionExact( incoming_energy,\n                                                       scattering_angle_cosine,\n                                                       subshell,\n                                                       precision );\n\n  if( integrated_cross_section > 0.0 )\n    return diff_cross_section/integrated_cross_section;\n  else\n    return 0.0;\n}\n\n// Evaluate the integrated cross section (b/mu)\n/*! \\details This will integrate the approximate double differential cross\n * section as function of unitless momentum from pz=-1.0 to pz=pz_max.\n */\ntemplate<typename ComptonProfilePolicy>\ndouble StandardCompleteDopplerBroadenedPhotonEnergyDistribution<ComptonProfilePolicy>::evaluateIntegratedCrossSection(\n\t\t\t\t\t  const double incoming_energy,\n\t\t\t\t\t  const double scattering_angle_cosine,\n\t\t\t\t\t  const double precision ) const\n{\n  // Make sure the incoming energy is valid\n  testPrecondition( incoming_energy > 0.0 );\n  // Make sure the scattering angle is valid\n  testPrecondition( scattering_angle_cosine >= -1.0 );\n  testPrecondition( scattering_angle_cosine <= 1.0 );\n\n  double cross_section = 0.0;\n\n  // Evaluate the integrated cross section for each subshell\n  SubshellOrderMapType::const_iterator subshell_it =\n    d_endf_subshell_order.begin();\n\n  while( subshell_it != d_endf_subshell_order.end() )\n  {\n    cross_section += this->evaluateSubshellIntegratedCrossSection(\n                                                       incoming_energy,\n                                                       scattering_angle_cosine,\n                                                       subshell_it->right,\n                                                       precision );\n\n    ++subshell_it;\n  }\n\n  // Make sure the integrated cross section is valid\n  testPrecondition( cross_section >= 0.0 );\n\n  return cross_section;\n}\n\n// Evaluate the exact integrated cross section (b/mu)\n/*! \\details This will integrate the exact double differential cross\n * section as function of outgoing energy from E=0.0 MeV to E=E_in-E_b^max.\n */\ntemplate<typename ComptonProfilePolicy>\ndouble StandardCompleteDopplerBroadenedPhotonEnergyDistribution<ComptonProfilePolicy>::evaluateIntegratedCrossSectionExact(\n\t\t\t\t\t  const double incoming_energy,\n\t\t\t\t\t  const double scattering_angle_cosine,\n\t\t\t\t\t  const double precision ) const\n{\n  // Make sure the incoming energy is valid\n  testPrecondition( incoming_energy > 0.0 );\n  // Make sure the scattering angle is valid\n  testPrecondition( scattering_angle_cosine >= -1.0 );\n  testPrecondition( scattering_angle_cosine <= 1.0 );\n\n  double cross_section = 0.0;\n\n  // Evaluate the integrated cross section for each subshell\n  SubshellOrderMapType::const_iterator subshell_it =\n    d_endf_subshell_order.begin();\n\n  while( subshell_it != d_endf_subshell_order.end() )\n  {\n    cross_section += this->evaluateSubshellIntegratedCrossSectionExact(\n                                                       incoming_energy,\n                                                       scattering_angle_cosine,\n                                                       subshell_it->right,\n                                                       precision );\n\n    ++subshell_it;\n  }\n\n  // Make sure the integrated cross section is valid\n  testPrecondition( cross_section >= 0.0 );\n\n  return cross_section;\n}\n\n// Evaluate the integrated cross section (b/mu)\n/*! \\details This will integrate the approximate double differential cross\n * section as a function of unitless momentum. If full profiles are being\n * used the limits of integration are pz=-1.0 and pz=pz_max. If half profiles\n * are being used the limits of integration are pz=-pz_max and pz=pz_max\n * (unless pz_max is <= 0.0 in which case the integrated cross section\n * will be 0.0).\n */\ntemplate<typename ComptonProfilePolicy>\ndouble StandardCompleteDopplerBroadenedPhotonEnergyDistribution<ComptonProfilePolicy>::evaluateSubshellIntegratedCrossSection(\n\t\t\t\t          const double incoming_energy,\n\t\t\t\t\t  const double scattering_angle_cosine,\n\t\t\t\t\t  const Data::SubshellType subshell,\n\t\t\t\t\t  const double precision ) const\n{\n  // Make sure the incoming energy is valid\n  testPrecondition( incoming_energy > 0.0 );\n  // Make sure the scattering angle is valid\n  testPrecondition( scattering_angle_cosine >= -1.0 );\n  testPrecondition( scattering_angle_cosine <= 1.0 );\n  // Make sure the subshell is valid\n  testPrecondition( this->isValidSubshell( subshell ) );\n\n  // Create the evaluation function wrapper\n  boost::function<double (double x)> double_diff_cs_wrapper =\n    boost::bind<double>( &StandardCompleteDopplerBroadenedPhotonEnergyDistribution::evaluateSubshellWithElectronMomentumProjection,\n                         boost::cref( *this ),\n                         incoming_energy,\n                         _1,\n                         scattering_angle_cosine,\n                         subshell );\n\n  // Get the subshell binding energy\n  const double subshell_binding_energy =\n    this->getSubshellBindingEnergy( subshell );\n\n  // Calculate the max electron momentum projection\n  double pz_max =\n    calculateMaxElectronMomentumProjection( incoming_energy,\n                                            subshell_binding_energy,\n                                            scattering_angle_cosine );\n\n  // Don't go above the table max (profile will evaluate to zero beyond it)\n  pz_max = ComptonProfilePolicy::getUpperLimitOfIntegration(\n                               this->getComptonProfile( subshell ),\n                               pz_max*ComptonProfile::MomentumUnit() ).value();\n\n  // Calculate the min electron momentum projection\n  double pz_min = ComptonProfilePolicy::getLowerLimitOfIntegration(\n                               pz_max*ComptonProfile::MomentumUnit() ).value();\n\n  // Calculate the absolute error and the integrated cross section\n  double abs_error, diff_cs;\n\n  Utility::GaussKronrodIntegrator<double> quadrature_set( precision );\n\n  if( pz_min < pz_max )\n  {\n    quadrature_set.integrateAdaptively<15>( double_diff_cs_wrapper,\n                                            pz_min,\n                                            pz_max,\n                                            diff_cs,\n                                            abs_error );\n  }\n  else\n  {\n    abs_error = 0.0;\n    diff_cs = 0.0;\n  }\n\n  // Make sure that the differential cross section is valid\n  testPostcondition( diff_cs >= 0.0 );\n\n  return diff_cs;\n}\n\n// Evaluate the integrated cross section (b/mu)\n/*! \\details This will integrate the exact double differential cross\n * section as a function of outgoing energy. The limits of integration are\n * E=0.0 and E=E_in-E_b,i (for both half profiles and full profiles).\n */\ntemplate<typename ComptonProfilePolicy>\ndouble StandardCompleteDopplerBroadenedPhotonEnergyDistribution<ComptonProfilePolicy>::evaluateSubshellIntegratedCrossSectionExact(\n\t\t\t\t          const double incoming_energy,\n\t\t\t\t\t  const double scattering_angle_cosine,\n\t\t\t\t\t  const Data::SubshellType subshell,\n\t\t\t\t\t  const double precision ) const\n{\n  // Make sure the incoming energy is valid\n  testPrecondition( incoming_energy > 0.0 );\n  // Make sure the scattering angle is valid\n  testPrecondition( scattering_angle_cosine >= -1.0 );\n  testPrecondition( scattering_angle_cosine <= 1.0 );\n  // Make sure the subshell is valid\n  testPrecondition( this->isValidSubshell( subshell ) );\n\n  // Create the evaluation function wrapper\n  boost::function<double (double x)> double_diff_cs_wrapper =\n    boost::bind<double>( &StandardCompleteDopplerBroadenedPhotonEnergyDistribution::evaluateSubshellExact,\n                         boost::cref( *this ),\n                         incoming_energy,\n                         _1,\n                         scattering_angle_cosine,\n                         subshell );\n\n  // Get the Compton profile for this subshell\n  const ComptonProfile& compton_profile = this->getComptonProfile( subshell );\n\n  // Calculate the max energy\n  double energy_max = incoming_energy -\n    this->getSubshellBindingEnergy( subshell );\n\n  // Calculate the max electron momentum projection\n  double pz_max = calculateMaxElectronMomentumProjection(\n                                  incoming_energy,\n                                  this->getSubshellBindingEnergy( subshell ),\n                                  scattering_angle_cosine );\n\n  // Calculate the max table energy\n  const double pz_table_max =\n    ComptonProfilePolicy::getUpperBoundOfMomentum( compton_profile ).value();\n\n  // Don't go above the table max (profile will evaluate to zero beyond it)\n  if( pz_max > pz_table_max )\n  {\n    bool energetically_possible;\n\n    energy_max = calculateDopplerBroadenedEnergy( pz_table_max,\n                                                  incoming_energy,\n                                                  scattering_angle_cosine,\n                                                  energetically_possible );\n  }\n\n  // Calculate the absolute error and the integrated cross section\n  double abs_error, diff_cs;\n\n  Utility::GaussKronrodIntegrator<double> quadrature_set( precision );\n\n  quadrature_set.integrateAdaptively<15>( double_diff_cs_wrapper,\n                                          0.0,\n                                          energy_max,\n                                          diff_cs,\n                                          abs_error );\n\n  // Make sure that the differential cross section is valid\n  testPostcondition( diff_cs >= 0.0 );\n\n  return diff_cs;\n}\n\n// Sample an outgoing energy from the distribution\ntemplate<typename ComptonProfilePolicy>\nvoid StandardCompleteDopplerBroadenedPhotonEnergyDistribution<ComptonProfilePolicy>::sample(\n\t\t\t       const double incoming_energy,\n                               const double scattering_angle_cosine,\n                               double& outgoing_energy,\n\t\t\t       Data::SubshellType& shell_of_interaction ) const\n{\n  Counter trial_dummy;\n\n  this->sampleAndRecordTrials( incoming_energy,\n\t\t\t       scattering_angle_cosine,\n\t\t\t       outgoing_energy,\n\t\t\t       shell_of_interaction,\n\t\t\t       trial_dummy );\n}\n\n// Sample an outgoing energy and record the number of trials\n/*! \\details The sampling of the Compton profile and the interaction subshell\n * are decoupled in this procedure.\n */\ntemplate<typename ComptonProfilePolicy>\nvoid StandardCompleteDopplerBroadenedPhotonEnergyDistribution<ComptonProfilePolicy>::sampleAndRecordTrials(\n\t\t\t\t     const double incoming_energy,\n\t\t\t\t     const double scattering_angle_cosine,\n\t\t\t\t     double& outgoing_energy,\n\t\t\t\t     Data::SubshellType& shell_of_interaction,\n\t\t\t\t     Counter& trials ) const\n{\n  // Make sure the incoming energy is valid\n  testPrecondition( incoming_energy > 0.0 );\n  // Make sure the scattering angle cosine is valid\n  testPrecondition( scattering_angle_cosine >= -1.0 );\n  testPrecondition( scattering_angle_cosine <= 1.0 );\n\n  // The electron momentum projection\n  double pz;\n\n  // Sample the electron momentum projection\n  this->sampleMomentumAndRecordTrials( incoming_energy,\n                                       scattering_angle_cosine,\n                                       pz,\n                                       shell_of_interaction,\n                                       trials );\n\n  bool energetically_possible;\n\n  outgoing_energy = calculateDopplerBroadenedEnergy( pz,\n                                                     incoming_energy,\n                                                     scattering_angle_cosine,\n                                                     energetically_possible );\n\n  // If a valid outgoing energy could not be calculated default to the\n  // Compton line energy (no Doppler broadening).\n  if( !energetically_possible || outgoing_energy < 0.0 )\n  {\n      outgoing_energy = calculateComptonLineEnergy( incoming_energy,\n                                                    scattering_angle_cosine );\n  }\n  else\n  {\n    // An energy of zero isn't allowed by the rest of the code\n    if( outgoing_energy == 0.0 )\n      outgoing_energy = std::numeric_limits<double>::min();\n  }\n\n  // Make sure the outgoing energy is valid\n  testPostcondition( outgoing_energy <= incoming_energy );\n  testPostcondition( outgoing_energy > 0.0 );\n  // Make sure that the sampled subshell is valid\n  testPostcondition( shell_of_interaction !=Data::UNKNOWN_SUBSHELL );\n  testPostcondition( shell_of_interaction != Data::INVALID_SUBSHELL );\n}\n\n// Sample an electron momentum from the distribution\n/*! \\details The sampling of the Compton profile and the interaction subshell\n * are decoupled in this procedure.\n */\ntemplate<typename ComptonProfilePolicy>\nvoid StandardCompleteDopplerBroadenedPhotonEnergyDistribution<ComptonProfilePolicy>::sampleMomentumAndRecordTrials(\n                                    const double incoming_energy,\n                                    const double scattering_angle_cosine,\n                                    double& electron_momentum,\n                                    Data::SubshellType& shell_of_interaction,\n                                    Counter& trials ) const\n{\n  // Make sure the incoming energy is valid\n  testPrecondition( incoming_energy > 0.0 );\n  // Make sure the scattering angle cosine is valid\n  testPrecondition( scattering_angle_cosine >= -1.0 );\n  testPrecondition( scattering_angle_cosine <= 1.0 );\n\n  // Record the number of iterations\n  Counter iterations = 0;\n\n  // Sample the shell that is interacted with\n  size_t compton_subshell_index;\n  double subshell_binding_energy;\n\n  // Only allow the selection of subshells where an incoherent interaction is\n  // energetically possible - there is definitely a more efficient way to do\n  // this!\n  while( true )\n  {\n    ++iterations;\n\n    this->sampleInteractionSubshell( compton_subshell_index,\n                                     subshell_binding_energy,\n                                     shell_of_interaction );\n\n    // Calculate the maximum outgoing photon energy\n    double energy_max = incoming_energy - subshell_binding_energy;\n\n    if( energy_max >= 0.0 )\n      break;\n  }\n\n  // Get the Compton profile for the sampled subshell\n  const ComptonProfile& compton_profile =\n    *d_compton_profile_array[compton_subshell_index];\n\n  electron_momentum = this->sampleSubshellMomentum( incoming_energy,\n                                                    scattering_angle_cosine,\n                                                    subshell_binding_energy,\n                                                    compton_profile );\n\n  // Increment the number of trials\n  trials += iterations;\n}\n\n// Sample an electron momentum from the subshell distribution\ntemplate<typename ComptonProfilePolicy>\ndouble StandardCompleteDopplerBroadenedPhotonEnergyDistribution<ComptonProfilePolicy>::sampleSubshellMomentum(\n                                     const double incoming_energy,\n                                     const double scattering_angle_cosine,\n                                     Data::SubshellType subshell ) const\n{\n  // Make sure the incoming energy is valid\n  testPrecondition( incoming_energy >=\n                    this->getSubshellBindingEnergy( subshell ) );\n  // Make sure the scattering angle cosine is valid\n  testPrecondition( scattering_angle_cosine >= -1.0 );\n  testPrecondition( scattering_angle_cosine <= 1.0 );\n  // Make sure the subshell is valid\n  testPrecondition( this->isValidSubshell( subshell ) );\n\n  // Get the subshell binding energy\n  const double subshell_binding_energy =\n    this->getSubshellBindingEnergy( subshell );\n\n  // Get the Compton profile for the subshell\n  const ComptonProfile& compton_profile = this->getComptonProfile( subshell );\n\n  return this->sampleSubshellMomentum( incoming_energy,\n                                       scattering_angle_cosine,\n                                       subshell_binding_energy,\n                                       compton_profile );\n}\n\n// Sample an electron momentum from the subshell distribution\ntemplate<typename ComptonProfilePolicy>\ndouble StandardCompleteDopplerBroadenedPhotonEnergyDistribution<ComptonProfilePolicy>::sampleSubshellMomentum(\n                                 const double incoming_energy,\n                                 const double scattering_angle_cosine,\n                                 const double subshell_binding_energy,\n                                 const ComptonProfile& compton_profile ) const\n{\n  // Make sure the incoming energy is valid\n  testPrecondition( incoming_energy > 0.0 );\n  // Make sure the scattering angle cosine is valid\n  testPrecondition( scattering_angle_cosine >= -1.0 );\n  testPrecondition( scattering_angle_cosine <= 1.0 );\n\n  // Calculate the maximum electron momentum projection\n  ComptonProfile::MomentumQuantity pz_max = ComptonProfile::MomentumUnit()*\n    calculateMaxElectronMomentumProjection( incoming_energy,\n                                            subshell_binding_energy,\n                                            scattering_angle_cosine );\n\n  // Sample an electron momentum projection\n  ComptonProfile::MomentumQuantity pz =\n    ComptonProfilePolicy::sample( compton_profile, pz_max );\n\n  return pz.value();\n}\n\n// Check if the subshell is valid\ntemplate<typename ComptonProfilePolicy>\nbool StandardCompleteDopplerBroadenedPhotonEnergyDistribution<ComptonProfilePolicy>::isValidSubshell(\n                                            const Data::SubshellType subshell ) const\n{\n  return d_endf_subshell_order.right.find( subshell ) !=\n    d_endf_subshell_order.right.end();\n}\n\n// Return the occupancy of a subshell (default is the ENDF occupancy)\ntemplate<typename ComptonProfilePolicy>\ninline double StandardCompleteDopplerBroadenedPhotonEnergyDistribution<ComptonProfilePolicy>::getSubshellOccupancy( const Data::SubshellType subshell ) const\n{\n  // Make sure the subshell is valid\n  testPrecondition( this->isValidSubshell( subshell ) );\n\n  unsigned endf_subshell_index = this->getENDFSubshellIndex( subshell );\n\n  return d_endf_subshell_occupancies[endf_subshell_index];\n}\n\n// Return the old subshell index corresponding to the subshell\ntemplate<typename ComptonProfilePolicy>\nunsigned StandardCompleteDopplerBroadenedPhotonEnergyDistribution<ComptonProfilePolicy>::getOldSubshellIndex(\n                                            const Data::SubshellType subshell ) const\n{\n  return d_subshell_converter->convertSubshellToIndex( subshell );\n}\n\n// Return the endf subshell index corresponding to the subshell\ntemplate<typename ComptonProfilePolicy>\nunsigned StandardCompleteDopplerBroadenedPhotonEnergyDistribution<ComptonProfilePolicy>::getENDFSubshellIndex(\n                                            const Data::SubshellType subshell ) const\n{\n  // Make sure the subshell is valid\n  testPrecondition( this->isValidSubshell( subshell ) );\n\n  return d_endf_subshell_order.right.find( subshell )->second;\n}\n\n// Return the subshell corresponding to the endf subshell index\ntemplate<typename ComptonProfilePolicy>\nData::SubshellType StandardCompleteDopplerBroadenedPhotonEnergyDistribution<ComptonProfilePolicy>::getSubshell(\n                                     const size_t endf_subshell_index ) const\n{\n  SubshellOrderMapType::left_map::const_iterator endf_subshell_index_it =\n    d_endf_subshell_order.left.find( endf_subshell_index );\n\n  // Make sure the index was found\n  testPostcondition( endf_subshell_index_it !=\n                     d_endf_subshell_order.left.end() );\n\n  return endf_subshell_index_it->second;\n}\n\n// Return the Compton profile for a subshell\ntemplate<typename ComptonProfilePolicy>\nconst ComptonProfile& StandardCompleteDopplerBroadenedPhotonEnergyDistribution<ComptonProfilePolicy>::getComptonProfile(\n                                           const Data::SubshellType& subshell ) const\n{\n  // Make sure the subshell is valid\n  testPrecondition( this->isValidSubshell( subshell ) );\n\n  // Get the old subshell corresponding to the subshell type\n  unsigned old_subshell_index = this->getOldSubshellIndex( subshell );\n\n  return *d_compton_profile_array[old_subshell_index];\n}\n\n// Return the Compton profile for an old subshell index\ntemplate<typename ComptonProfilePolicy>\nconst ComptonProfile& StandardCompleteDopplerBroadenedPhotonEnergyDistribution<ComptonProfilePolicy>::getComptonProfile(\n                                     const unsigned& old_subshell_index ) const\n{\n  // Make sure the old subshell index is valid\n  testPrecondition( old_subshell_index <\n                    d_compton_profile_array.size() );\n\n  return *d_compton_profile_array[old_subshell_index];\n}\n\n// Sample an ENDF subshell\ntemplate<typename ComptonProfilePolicy>\nData::SubshellType StandardCompleteDopplerBroadenedPhotonEnergyDistribution<ComptonProfilePolicy>::sampleENDFInteractionSubshell() const\n{\n  size_t endf_subshell_index;\n\n  d_endf_subshell_occupancy_distribution->sampleAndRecordBinIndex(\n                                                         endf_subshell_index );\n\n  return this->getSubshell( endf_subshell_index );\n}\n\nEXTERN_EXPLICIT_TEMPLATE_CLASS_INST( StandardCompleteDopplerBroadenedPhotonEnergyDistribution<FullComptonProfilePolicy> );\nEXTERN_EXPLICIT_TEMPLATE_CLASS_INST( StandardCompleteDopplerBroadenedPhotonEnergyDistribution<HalfComptonProfilePolicy> );\nEXTERN_EXPLICIT_TEMPLATE_CLASS_INST( StandardCompleteDopplerBroadenedPhotonEnergyDistribution<DoubledHalfComptonProfilePolicy> );\n\n} // end MonteCarlo namespace\n\n#endif // end MONTE_CARLO_STANDARD_COMPLETE_DOPPLER_BROADENED_PHOTON_ENERGY_DISTRIBUTION_DEF_HPP\n\n//---------------------------------------------------------------------------//\n// end MonteCarlo_StandardCompleteDopplerBroadenedPhotonEnergyDistribution_def.hpp\n//---------------------------------------------------------------------------//\n", "meta": {"hexsha": "41626e6b7f46e04441ab738c05f18bc0c1095ab1", "size": 39028, "ext": "hpp", "lang": "C++", "max_stars_repo_path": "packages/monte_carlo/collision/photon/src/MonteCarlo_StandardCompleteDopplerBroadenedPhotonEnergyDistribution_def.hpp", "max_stars_repo_name": "bam241/FRENSIE", "max_stars_repo_head_hexsha": "e1760cd792928699c84f2bdce70ff54228e88094", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 10.0, "max_stars_repo_stars_event_min_datetime": "2019-11-14T19:58:30.000Z", "max_stars_repo_stars_event_max_datetime": "2021-04-04T17:44:09.000Z", "max_issues_repo_path": "packages/monte_carlo/collision/photon/src/MonteCarlo_StandardCompleteDopplerBroadenedPhotonEnergyDistribution_def.hpp", "max_issues_repo_name": "bam241/FRENSIE", "max_issues_repo_head_hexsha": "e1760cd792928699c84f2bdce70ff54228e88094", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 43.0, "max_issues_repo_issues_event_min_datetime": "2020-03-03T19:59:20.000Z", "max_issues_repo_issues_event_max_datetime": "2021-09-08T03:36:08.000Z", "max_forks_repo_path": "packages/monte_carlo/collision/photon/src/MonteCarlo_StandardCompleteDopplerBroadenedPhotonEnergyDistribution_def.hpp", "max_forks_repo_name": "bam241/FRENSIE", "max_forks_repo_head_hexsha": "e1760cd792928699c84f2bdce70ff54228e88094", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 6.0, "max_forks_repo_forks_event_min_datetime": "2020-02-12T17:37:07.000Z", "max_forks_repo_forks_event_max_datetime": "2020-09-08T18:59:51.000Z", "avg_line_length": 41.7411764706, "max_line_length": 157, "alphanum_fraction": 0.6586297018, "num_tokens": 7617, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO", "lm_q1_score": 0.5389832206876841, "lm_q2_score": 0.2509127924867847, "lm_q1q2_score": 0.1352377850062678}}
{"text": "//---------------------------------------------------------------------------//\n//!\n//! \\file   MonteCarlo_DecoupledCompleteDopplerBroadenedPhotonEnergyDistribution.hpp\n//! \\author Alex Robinson\n//! \\brief  The decoupled complete Doppler broadened photon energy dist. decl.\n//!\n//---------------------------------------------------------------------------//\n\n#ifndef MONTE_CARLO_DECOUPLED_COMPLETE_DOPPLER_BROADENED_PHOTON_ENERGY_DISTRIBUTION_HPP\n#define MONTE_CARLO_DECOUPLED_COMPLETE_DOPPLER_BROADENED_PHOTON_ENERGY_DISTRIBUTION_HPP\n\n// Boost Includes\n#include <boost/scoped_ptr.hpp>\n\n// FRENSE Includes\n#include \"MonteCarlo_CompleteDopplerBroadenedPhotonEnergyDistribution.hpp\"\n#include \"MonteCarlo_ComptonProfileSubshellConverter.hpp\"\n#include \"Utility_TabularOneDDistribution.hpp\"\n\nnamespace MonteCarlo{\n\n//! The decoupled complete Doppler broadenening photon energy dist. class\nclass DecoupledCompleteDopplerBroadenedPhotonEnergyDistribution : public CompleteDopplerBroadenedPhotonEnergyDistribution\n{\n\npublic:\n  \n  //! Constructor\n  DecoupledCompleteDopplerBroadenedPhotonEnergyDistribution(\n\t       const Teuchos::Array<double>& endf_subshell_occupancies,\n\t       const Teuchos::Array<SubshellType>& endf_subshell_order,\n\t       const Teuchos::Array<double>& old_subshell_binding_energies,\n\t       const Teuchos::Array<double>& old_subshell_occupancies,\n\t       const ElectronMomentumDistArray& electron_momentum_dist_array );\n\n  //! Destructor\n  virtual ~DecoupledCompleteDopplerBroadenedPhotonEnergyDistribution()\n  { /* ... */ }\n  \n\n  //! Evaluate the distribution\n  double evaluate( const double incoming_energy,\n\t\t   const double outgoing_energy,\n\t\t   const double scattering_angle_cosine ) const;\n    \n  //! Evaluate the subshell distribution\n  double evaluateSubshell( const double incoming_energy,\n\t\t\t   const double outgoing_energy,\n\t\t\t   const double scattering_angle_cosine,\n\t\t\t   const SubshellType subshell ) const;\n\n  //! Evaluate the PDF\n  double evaluatePDF( const double incoming_energy,\n\t\t      const double outgoing_energy,\n\t\t      const double scattering_angle_cosine ) const;\n\n  //! Evaluate the PDF\n  double evaluateSubshellPDF( const double incoming_energy,\n\t\t\t      const double outgoing_energy,\n\t\t\t      const double scattering_angle_cosine,\n\t\t\t      const SubshellType subshell ) const;\n\n  //! Evaluate the integrated cross section (b/mu)\n  double evaluateIntegratedCrossSection( const double incoming_energy,\n\t\t\t\t\t const double scattering_angle_cosine,\n\t\t\t\t\t const double precision ) const;\n\n  //! Evaluate the integrated cross section (b/mu)\n  double evaluateSubshellIntegratedCrossSection( \n\t\t\t\t          const double incoming_energy,\n\t\t\t\t\t  const double scattering_angle_cosine,\n\t\t\t\t\t  const SubshellType subshell,\n\t\t\t\t\t  const double precision ) const;\n\n  //! Sample an outgoing energy from the distribution\n  void sample( const double incoming_energy,\n\t       const double scattering_angle_cosine,\n\t       double& outgoing_energy,\n\t       SubshellType& shell_of_interaction ) const;\n\n  //! Sample an outgoing energy and record the number of trials\n  void sampleAndRecordTrials( const double incoming_energy,\n\t\t\t      const double scattering_angle_cosine,\n\t\t\t      double& outgoing_energy,\n\t\t\t      SubshellType& shell_of_interaction,\n\t\t\t      unsigned& trials ) const;\n\nprivate:\n\n  // Sample the old subshell that is interacted with\n  void sampleOldInteractionSubshell( \n\t\t\t\t   unsigned& old_shell_of_interaction,\n\t\t\t\t   double& old_subshell_binding_energy ) const;\n\n  // The old subshell interaction probabilities\n  boost::scoped_ptr<const Utility::TabularOneDDistribution>\n  d_old_subshell_occupancy_distribution;\n\n  // The old subshell binding energies\n  Teuchos::Array<double> d_old_subshell_binding_energy;\n\n  // The old subshell occupandies\n  Teuchos::Array<double> d_old_subshell_occupancies;\n  \n  // Records if the Compton profiles are half (standard) or full\n  bool d_half_profiles;\n\n  // The electron momentum dist array\n  ElectronMomentumDistArray d_electron_momentum_distribution;\n};\n\n} // end MonteCarlo namespace\n\n#endif // end MONTE_CARLO_DECOUPLED_COMPLETE_DOPPLER_BROADENED_PHOTON_ENERGY_DISTRIBUTION_HPP\n\n//---------------------------------------------------------------------------//\n// end MonteCarlo_DecoupledCompleteDopplerBroadenedPhotonEnergyDistribution.hpp\n//---------------------------------------------------------------------------//\n", "meta": {"hexsha": "4de6fd6f24162e6864920147e1d4fee8bc96d01c", "size": 4403, "ext": "hpp", "lang": "C++", "max_stars_repo_path": "packages/monte_carlo/collision/native/src/MonteCarlo_DecoupledCompleteDopplerBroadenedPhotonEnergyDistribution.hpp", "max_stars_repo_name": "lkersting/SCR-2123", "max_stars_repo_head_hexsha": "06ae3d92998664a520dc6a271809a5aeffe18f72", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "packages/monte_carlo/collision/native/src/MonteCarlo_DecoupledCompleteDopplerBroadenedPhotonEnergyDistribution.hpp", "max_issues_repo_name": "lkersting/SCR-2123", "max_issues_repo_head_hexsha": "06ae3d92998664a520dc6a271809a5aeffe18f72", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "packages/monte_carlo/collision/native/src/MonteCarlo_DecoupledCompleteDopplerBroadenedPhotonEnergyDistribution.hpp", "max_forks_repo_name": "lkersting/SCR-2123", "max_forks_repo_head_hexsha": "06ae3d92998664a520dc6a271809a5aeffe18f72", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 37.0, "max_line_length": 121, "alphanum_fraction": 0.7229161935, "num_tokens": 909, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO", "lm_q1_score": 0.5156199157230156, "lm_q2_score": 0.256832002764217, "lm_q1q2_score": 0.13242769562025888}}
{"text": "// Distributed under the MIT License.\n// See LICENSE.txt for details.\n\n#pragma once\n\n#include <algorithm>\n#include <array>\n#include <boost/functional/hash.hpp>\n#include <cstddef>\n#include <iterator>\n#include <type_traits>\n#include <utility>\n\n#include \"DataStructures/DataVector.hpp\"\n#include \"DataStructures/FixedHashMap.hpp\"\n#include \"DataStructures/Index.hpp\"\n#include \"DataStructures/Tensor/Tensor.hpp\"\n#include \"DataStructures/Variables.hpp\"\n#include \"Domain/Structure/Direction.hpp\"\n#include \"Domain/Structure/DirectionMap.hpp\"\n#include \"Domain/Structure/Element.hpp\"\n#include \"Domain/Structure/ElementId.hpp\"\n#include \"Domain/Structure/MaxNumberOfNeighbors.hpp\"\n#include \"Evolution/Systems/GeneralizedHarmonic/Tags.hpp\"\n#include \"Evolution/Systems/GrMhd/ValenciaDivClean/ConservativeFromPrimitive.hpp\"\n#include \"Evolution/Systems/GrMhd/ValenciaDivClean/FiniteDifference/ReconstructWork.tpp\"\n#include \"Evolution/Systems/GrMhd/ValenciaDivClean/Tags.hpp\"\n#include \"NumericalAlgorithms/Spectral/Mesh.hpp\"\n#include \"PointwiseFunctions/GeneralRelativity/Tags.hpp\"\n#include \"PointwiseFunctions/Hydro/EquationsOfState/EquationOfState.hpp\"\n#include \"PointwiseFunctions/Hydro/SpecificEnthalpy.hpp\"\n#include \"PointwiseFunctions/Hydro/Tags.hpp\"\n#include \"Utilities/ErrorHandling/Assert.hpp\"\n#include \"Utilities/Gsl.hpp\"\n#include \"Utilities/TMPL.hpp\"\n\nnamespace grmhd::GhValenciaDivClean::fd {\ntemplate <typename SpacetimeTagsToReconstruct, typename PrimsTags,\n          typename SpacetimeAndConsTags, typename TagsList,\n          size_t ThermodynamicDim, typename HydroReconstructor,\n          typename SpacetimeReconstructor,\n          typename ComputeGrmhdSpacetimeVarsFromReconstructedSpacetimeTags>\nvoid reconstruct_prims_work(\n    const gsl::not_null<std::array<Variables<TagsList>, 3>*> vars_on_lower_face,\n    const gsl::not_null<std::array<Variables<TagsList>, 3>*> vars_on_upper_face,\n    const HydroReconstructor& hydro_reconstructor,\n    const SpacetimeReconstructor& spacetime_reconstructor,\n    const ComputeGrmhdSpacetimeVarsFromReconstructedSpacetimeTags&\n        spacetime_vars_for_grmhd,\n    const Variables<PrimsTags>& volume_prims,\n    const Variables<SpacetimeAndConsTags>& volume_spacetime_and_cons_vars,\n    const EquationsOfState::EquationOfState<true, ThermodynamicDim>& eos,\n    const Element<3>& element,\n    const FixedHashMap<\n        maximum_number_of_neighbors(3) + 1,\n        std::pair<Direction<3>, ElementId<3>>, std::vector<double>,\n        boost::hash<std::pair<Direction<3>, ElementId<3>>>>& neighbor_data,\n    const Mesh<3>& subcell_mesh, size_t ghost_zone_size) {\n  using prim_tags_for_reconstruction =\n      tmpl::list<hydro::Tags::RestMassDensity<DataVector>,\n                 hydro::Tags::Pressure<DataVector>,\n                 hydro::Tags::LorentzFactorTimesSpatialVelocity<DataVector, 3>,\n                 hydro::Tags::MagneticField<DataVector, 3>,\n                 hydro::Tags::DivergenceCleaningField<DataVector>>;\n\n  ASSERT(Mesh<3>(subcell_mesh.extents(0), subcell_mesh.basis(0),\n                 subcell_mesh.quadrature(0)) == subcell_mesh,\n         \"The subcell mesh should be isotropic but got \" << subcell_mesh);\n  const size_t volume_num_pts = subcell_mesh.number_of_grid_points();\n  const size_t reconstructed_num_pts =\n      (subcell_mesh.extents(0) + 1) *\n      subcell_mesh.extents().slice_away(0).product();\n  const size_t neighbor_num_pts =\n      ghost_zone_size * subcell_mesh.extents().slice_away(0).product();\n  size_t vars_in_neighbor_count = 0;\n  tmpl::for_each<prim_tags_for_reconstruction>([&element, &neighbor_data,\n                                                neighbor_num_pts,\n                                                &hydro_reconstructor,\n                                                reconstructed_num_pts,\n                                                volume_num_pts, &volume_prims,\n                                                &vars_in_neighbor_count,\n                                                &vars_on_lower_face,\n                                                &vars_on_upper_face,\n                                                &subcell_mesh](auto tag_v) {\n    using tag = tmpl::type_from<decltype(tag_v)>;\n    const typename tag::type* volume_tensor_ptr = nullptr;\n    Variables<tmpl::list<\n        hydro::Tags::LorentzFactorTimesSpatialVelocity<DataVector, 3>>>\n        lorentz_factor_times_v_I{};\n    if constexpr (std::is_same_v<tag,\n                                 hydro::Tags::LorentzFactorTimesSpatialVelocity<\n                                     DataVector, 3>>) {\n      // we need to handle the Wv^i reconstruction separately since we need to\n      // first compute Wv^i in the volume (it's not one of our primitives from\n      // the recovery). The components need to be stored contiguously, which is\n      // why we have the Variables `lorentz_factor_times_v_I`\n      const auto& spatial_velocity =\n          get<hydro::Tags::SpatialVelocity<DataVector, 3>>(volume_prims);\n      const auto& lorentz_factor =\n          get<hydro::Tags::LorentzFactor<DataVector>>(volume_prims);\n      lorentz_factor_times_v_I.initialize(get(lorentz_factor).size());\n      auto& volume_tensor =\n          get<hydro::Tags::LorentzFactorTimesSpatialVelocity<DataVector, 3>>(\n              lorentz_factor_times_v_I) = spatial_velocity;\n      for (size_t i = 0; i < 3; ++i) {\n        volume_tensor.get(i) *= get(lorentz_factor);\n      }\n      volume_tensor_ptr = &volume_tensor;\n    } else {\n      volume_tensor_ptr = &get<tag>(volume_prims);\n    }\n\n    const size_t number_of_variables = volume_tensor_ptr->size();\n    const gsl::span<const double> volume_vars = gsl::make_span(\n        (*volume_tensor_ptr)[0].data(), number_of_variables * volume_num_pts);\n    std::array<gsl::span<double>, 3> upper_face_vars{};\n    std::array<gsl::span<double>, 3> lower_face_vars{};\n    for (size_t i = 0; i < 3; ++i) {\n      gsl::at(upper_face_vars, i) =\n          gsl::make_span(get<tag>(gsl::at(*vars_on_upper_face, i))[0].data(),\n                         number_of_variables * reconstructed_num_pts);\n      gsl::at(lower_face_vars, i) =\n          gsl::make_span(get<tag>(gsl::at(*vars_on_lower_face, i))[0].data(),\n                         number_of_variables * reconstructed_num_pts);\n    }\n\n    DirectionMap<3, gsl::span<const double>> ghost_cell_vars{};\n    for (const auto& direction : Direction<3>::all_directions()) {\n      const auto& neighbors_in_direction = element.neighbors().at(direction);\n      ASSERT(neighbors_in_direction.size() == 1,\n             \"Currently only support one neighbor in each direction, but \"\n             \"got \"\n                 << neighbors_in_direction.size() << \" in direction \"\n                 << direction);\n      ghost_cell_vars[direction] = gsl::make_span(\n          &neighbor_data.at(std::pair{\n              direction,\n              *neighbors_in_direction\n                   .begin()})[vars_in_neighbor_count * neighbor_num_pts],\n          number_of_variables * neighbor_num_pts);\n    }\n\n    hydro_reconstructor(make_not_null(&upper_face_vars),\n                        make_not_null(&lower_face_vars), volume_vars,\n                        ghost_cell_vars, subcell_mesh.extents(),\n                        number_of_variables);\n\n    vars_in_neighbor_count += number_of_variables;\n  });\n  tmpl::for_each<SpacetimeTagsToReconstruct>(\n      [&element, &neighbor_data, neighbor_num_pts, &spacetime_reconstructor,\n       reconstructed_num_pts, volume_num_pts, &volume_spacetime_and_cons_vars,\n       &vars_in_neighbor_count, &vars_on_lower_face, &vars_on_upper_face,\n       &subcell_mesh](auto tag_v) {\n        using tag = tmpl::type_from<decltype(tag_v)>;\n        const typename tag::type& volume_tensor =\n            get<tag>(volume_spacetime_and_cons_vars);\n\n        const size_t number_of_variables = volume_tensor.size();\n        const gsl::span<const double> volume_vars = gsl::make_span(\n            (volume_tensor)[0].data(), number_of_variables * volume_num_pts);\n        std::array<gsl::span<double>, 3> upper_face_vars{};\n        std::array<gsl::span<double>, 3> lower_face_vars{};\n        for (size_t i = 0; i < 3; ++i) {\n          gsl::at(upper_face_vars, i) = gsl::make_span(\n              get<tag>(gsl::at(*vars_on_upper_face, i))[0].data(),\n              number_of_variables * reconstructed_num_pts);\n          gsl::at(lower_face_vars, i) = gsl::make_span(\n              get<tag>(gsl::at(*vars_on_lower_face, i))[0].data(),\n              number_of_variables * reconstructed_num_pts);\n        }\n\n        DirectionMap<3, gsl::span<const double>> ghost_cell_vars{};\n        for (const auto& direction : Direction<3>::all_directions()) {\n          const auto& neighbors_in_direction =\n              element.neighbors().at(direction);\n          ASSERT(neighbors_in_direction.size() == 1,\n                 \"Currently only support one neighbor in each direction, but \"\n                 \"got \"\n                     << neighbors_in_direction.size() << \" in direction \"\n                     << direction);\n          ghost_cell_vars[direction] = gsl::make_span(\n              &neighbor_data.at(std::pair{\n                  direction,\n                  *neighbors_in_direction\n                       .begin()})[vars_in_neighbor_count * neighbor_num_pts],\n              number_of_variables * neighbor_num_pts);\n        }\n\n        spacetime_reconstructor(make_not_null(&upper_face_vars),\n                                make_not_null(&lower_face_vars), volume_vars,\n                                ghost_cell_vars, subcell_mesh.extents(),\n                                number_of_variables);\n\n        vars_in_neighbor_count += number_of_variables;\n      });\n\n  for (size_t i = 0; i < 3; ++i) {\n    if constexpr (tmpl::size<SpacetimeTagsToReconstruct>::value != 0) {\n      spacetime_vars_for_grmhd(make_not_null(&gsl::at(*vars_on_lower_face, i)));\n      spacetime_vars_for_grmhd(make_not_null(&gsl::at(*vars_on_upper_face, i)));\n    }\n\n    ValenciaDivClean::fd::compute_conservatives_for_reconstruction(\n        make_not_null(&gsl::at(*vars_on_lower_face, i)), eos);\n    ValenciaDivClean::fd::compute_conservatives_for_reconstruction(\n        make_not_null(&gsl::at(*vars_on_upper_face, i)), eos);\n  }\n}\n\ntemplate <\n    typename TagsList, typename PrimsTags, size_t ThermodynamicDim,\n    typename LowerHydroReconstructor, typename LowerSpacetimeReconstructor,\n    typename UpperHydroReconstructor, typename UpperSpacetimeReconstructor,\n    typename ComputeGrmhdSpacetimeVarsFromReconstructedSpacetimeTags>\nvoid reconstruct_fd_neighbor_work(\n    const gsl::not_null<Variables<TagsList>*> vars_on_face,\n    const LowerHydroReconstructor& reconstruct_lower_neighbor_hydro,\n    const LowerSpacetimeReconstructor& reconstruct_lower_neighbor_spacetime,\n    const UpperHydroReconstructor& reconstruct_upper_neighbor_hydro,\n    const UpperSpacetimeReconstructor& reconstruct_upper_neighbor_spacetime,\n    const ComputeGrmhdSpacetimeVarsFromReconstructedSpacetimeTags&\n        spacetime_vars_for_grmhd,\n    const Variables<PrimsTags>& subcell_volume_prims,\n    const Variables<tmpl::list<\n        gr::Tags::SpacetimeMetric<3>, GeneralizedHarmonic::Tags::Phi<3>,\n        GeneralizedHarmonic::Tags::Pi<3>>>& subcell_volume_spacetime_vars,\n    const EquationsOfState::EquationOfState<true, ThermodynamicDim>& eos,\n    const Element<3>& element,\n    const FixedHashMap<\n        maximum_number_of_neighbors(3) + 1,\n        std::pair<Direction<3>, ElementId<3>>, std::vector<double>,\n        boost::hash<std::pair<Direction<3>, ElementId<3>>>>& neighbor_data,\n    const Mesh<3>& subcell_mesh, const Direction<3>& direction_to_reconstruct,\n    const size_t ghost_zone_size) {\n  using prim_tags_for_reconstruction =\n      tmpl::list<hydro::Tags::RestMassDensity<DataVector>,\n                 hydro::Tags::Pressure<DataVector>,\n                 hydro::Tags::LorentzFactorTimesSpatialVelocity<DataVector, 3>,\n                 hydro::Tags::MagneticField<DataVector, 3>,\n                 hydro::Tags::DivergenceCleaningField<DataVector>>;\n  using spacetime_tags = tmpl::list<gr::Tags::SpacetimeMetric<3>,\n                                    GeneralizedHarmonic::Tags::Phi<3>,\n                                    GeneralizedHarmonic::Tags::Pi<3>>;\n\n  const std::pair mortar_id{\n      direction_to_reconstruct,\n      *element.neighbors().at(direction_to_reconstruct).begin()};\n  Index<3> ghost_data_extents = subcell_mesh.extents();\n  ghost_data_extents[direction_to_reconstruct.dimension()] = ghost_zone_size;\n  Variables<tmpl::append<prim_tags_for_reconstruction, spacetime_tags>>\n      neighbor_prims{ghost_data_extents.product()};\n  {\n    ASSERT(neighbor_data.contains(mortar_id),\n           \"The neighbor data does not contain the mortar: (\"\n               << mortar_id.first << ',' << mortar_id.second << \")\");\n    const auto& neighbor_data_on_mortar = neighbor_data.at(mortar_id);\n    std::copy(neighbor_data_on_mortar.begin(),\n              std::next(neighbor_data_on_mortar.begin(),\n                        static_cast<std::ptrdiff_t>(\n                            neighbor_prims.number_of_independent_components *\n                            ghost_data_extents.product())),\n              neighbor_prims.data());\n  }\n\n  tmpl::for_each<prim_tags_for_reconstruction>(\n      [&direction_to_reconstruct, &ghost_data_extents, &neighbor_prims,\n       &reconstruct_lower_neighbor_hydro, &reconstruct_upper_neighbor_hydro,\n       &subcell_mesh, &subcell_volume_prims, &vars_on_face](auto tag_v) {\n        using tag = tmpl::type_from<decltype(tag_v)>;\n        const typename tag::type* volume_tensor_ptr = nullptr;\n        typename tag::type volume_tensor{};\n        if constexpr (std::is_same_v<\n                          tag, hydro::Tags::LorentzFactorTimesSpatialVelocity<\n                                   DataVector, 3>>) {\n          // we need to handle the Wv^i reconstruction separately since we need\n          // to first compute Wv^i in the volume (it's not one of our primitives\n          // from the recovery). The components need to be stored contiguously,\n          // which is why we have the Variables `lorentz_factor_times_v_I`\n          const auto& spatial_velocity =\n              get<hydro::Tags::SpatialVelocity<DataVector, 3>>(\n                  subcell_volume_prims);\n          const auto& lorentz_factor =\n              get<hydro::Tags::LorentzFactor<DataVector>>(subcell_volume_prims);\n          volume_tensor = spatial_velocity;\n          for (size_t i = 0; i < 3; ++i) {\n            volume_tensor.get(i) *= get(lorentz_factor);\n          }\n          volume_tensor_ptr = &volume_tensor;\n        } else {\n          volume_tensor_ptr = &get<tag>(subcell_volume_prims);\n        }\n\n        const auto& tensor_neighbor = get<tag>(neighbor_prims);\n        auto& tensor_on_face = get<tag>(*vars_on_face);\n        if (direction_to_reconstruct.side() == Side::Upper) {\n          for (size_t tensor_index = 0; tensor_index < tensor_on_face.size();\n               ++tensor_index) {\n            reconstruct_upper_neighbor_hydro(\n                make_not_null(&tensor_on_face[tensor_index]),\n                (*volume_tensor_ptr)[tensor_index],\n                tensor_neighbor[tensor_index], subcell_mesh.extents(),\n                ghost_data_extents, direction_to_reconstruct);\n          }\n        } else {\n          for (size_t tensor_index = 0; tensor_index < tensor_on_face.size();\n               ++tensor_index) {\n            reconstruct_lower_neighbor_hydro(\n                make_not_null(&tensor_on_face[tensor_index]),\n                (*volume_tensor_ptr)[tensor_index],\n                tensor_neighbor[tensor_index], subcell_mesh.extents(),\n                ghost_data_extents, direction_to_reconstruct);\n          }\n        }\n      });\n\n  tmpl::for_each<spacetime_tags>(\n      [&direction_to_reconstruct, &ghost_data_extents, &neighbor_prims,\n       &reconstruct_lower_neighbor_spacetime,\n       &reconstruct_upper_neighbor_spacetime, &subcell_mesh,\n       &subcell_volume_spacetime_vars, &vars_on_face](auto tag_v) {\n        using tag = tmpl::type_from<decltype(tag_v)>;\n        const typename tag::type volume_tensor =\n            get<tag>(subcell_volume_spacetime_vars);\n\n        const auto& tensor_neighbor = get<tag>(neighbor_prims);\n        auto& tensor_on_face = get<tag>(*vars_on_face);\n        if (direction_to_reconstruct.side() == Side::Upper) {\n          for (size_t tensor_index = 0; tensor_index < tensor_on_face.size();\n               ++tensor_index) {\n            reconstruct_upper_neighbor_spacetime(\n                make_not_null(&tensor_on_face[tensor_index]),\n                volume_tensor[tensor_index], tensor_neighbor[tensor_index],\n                subcell_mesh.extents(), ghost_data_extents,\n                direction_to_reconstruct);\n          }\n        } else {\n          for (size_t tensor_index = 0; tensor_index < tensor_on_face.size();\n               ++tensor_index) {\n            reconstruct_lower_neighbor_spacetime(\n                make_not_null(&tensor_on_face[tensor_index]),\n                volume_tensor[tensor_index], tensor_neighbor[tensor_index],\n                subcell_mesh.extents(), ghost_data_extents,\n                direction_to_reconstruct);\n          }\n        }\n      });\n\n  spacetime_vars_for_grmhd(vars_on_face);\n  ValenciaDivClean::fd::compute_conservatives_for_reconstruction(vars_on_face,\n                                                                 eos);\n}\n}  // namespace grmhd::GhValenciaDivClean::fd\n", "meta": {"hexsha": "9b630010bdacd1599101e9e1fcf5649109105a03", "size": 17475, "ext": "tpp", "lang": "C++", "max_stars_repo_path": "src/Evolution/Systems/GrMhd/GhValenciaDivClean/FiniteDifference/ReconstructWork.tpp", "max_stars_repo_name": "nilsvu/spectre", "max_stars_repo_head_hexsha": "1455b9a8d7e92db8ad600c66f54795c29c3052ee", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 117.0, "max_stars_repo_stars_event_min_datetime": "2017-04-08T22:52:48.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-25T07:23:36.000Z", "max_issues_repo_path": "src/Evolution/Systems/GrMhd/GhValenciaDivClean/FiniteDifference/ReconstructWork.tpp", "max_issues_repo_name": "nilsvu/spectre", "max_issues_repo_head_hexsha": "1455b9a8d7e92db8ad600c66f54795c29c3052ee", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 3177.0, "max_issues_repo_issues_event_min_datetime": "2017-04-07T21:10:18.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T23:55:59.000Z", "max_forks_repo_path": "src/Evolution/Systems/GrMhd/GhValenciaDivClean/FiniteDifference/ReconstructWork.tpp", "max_forks_repo_name": "nilsvu/spectre", "max_forks_repo_head_hexsha": "1455b9a8d7e92db8ad600c66f54795c29c3052ee", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 85.0, "max_forks_repo_forks_event_min_datetime": "2017-04-07T19:36:13.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-01T10:21:00.000Z", "avg_line_length": 49.3644067797, "max_line_length": 88, "alphanum_fraction": 0.6549928469, "num_tokens": 3944, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO", "lm_q1_score": 0.5039061705290805, "lm_q2_score": 0.25982563222951205, "lm_q1q2_score": 0.13092773934207064}}
{"text": "// Boost.Geometry\r\n// This file is manually converted from PROJ4\r\n\r\n// This file was modified by Oracle on 2017.\r\n// Modifications copyright (c) 2017, Oracle and/or its affiliates.\r\n// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle\r\n\r\n// Use, modification and distribution is subject to the Boost Software License,\r\n// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at\r\n// http://www.boost.org/LICENSE_1_0.txt)\r\n\r\n// This file is converted from PROJ4, http://trac.osgeo.org/proj\r\n// PROJ4 is originally written by Gerald Evenden (then of the USGS)\r\n// PROJ4 is maintained by Frank Warmerdam\r\n// This file was converted to Geometry Library by Adam Wulkiewicz\r\n\r\n// Original copyright notice:\r\n\r\n/***************************************************************************/\r\n/* RSC IDENTIFIER:  GEOCENTRIC\r\n *\r\n * ABSTRACT\r\n *\r\n *    This component provides conversions between Geodetic coordinates (latitude,\r\n *    longitude in radians and height in meters) and Geocentric coordinates\r\n *    (X, Y, Z) in meters.\r\n *\r\n * ERROR HANDLING\r\n *\r\n *    This component checks parameters for valid values.  If an invalid value\r\n *    is found, the error code is combined with the current error code using \r\n *    the bitwise or.  This combining allows multiple error codes to be\r\n *    returned. The possible error codes are:\r\n *\r\n *      GEOCENT_NO_ERROR        : No errors occurred in function\r\n *      GEOCENT_LAT_ERROR       : Latitude out of valid range\r\n *                                 (-90 to 90 degrees)\r\n *      GEOCENT_LON_ERROR       : Longitude out of valid range\r\n *                                 (-180 to 360 degrees)\r\n *      GEOCENT_A_ERROR         : Semi-major axis lessthan or equal to zero\r\n *      GEOCENT_B_ERROR         : Semi-minor axis lessthan or equal to zero\r\n *      GEOCENT_A_LESS_B_ERROR  : Semi-major axis less than semi-minor axis\r\n *\r\n *\r\n * REUSE NOTES\r\n *\r\n *    GEOCENTRIC is intended for reuse by any application that performs\r\n *    coordinate conversions between geodetic coordinates and geocentric\r\n *    coordinates.\r\n *    \r\n *\r\n * REFERENCES\r\n *    \r\n *    An Improved Algorithm for Geocentric to Geodetic Coordinate Conversion,\r\n *    Ralph Toms, February 1996  UCRL-JC-123138.\r\n *    \r\n *    Further information on GEOCENTRIC can be found in the Reuse Manual.\r\n *\r\n *    GEOCENTRIC originated from : U.S. Army Topographic Engineering Center\r\n *                                 Geospatial Information Division\r\n *                                 7701 Telegraph Road\r\n *                                 Alexandria, VA  22310-3864\r\n *\r\n * LICENSES\r\n *\r\n *    None apply to this component.\r\n *\r\n * RESTRICTIONS\r\n *\r\n *    GEOCENTRIC has no restrictions.\r\n *\r\n * ENVIRONMENT\r\n *\r\n *    GEOCENTRIC was tested and certified in the following environments:\r\n *\r\n *    1. Solaris 2.5 with GCC version 2.8.1\r\n *    2. Windows 95 with MS Visual C++ version 6\r\n *\r\n * MODIFICATIONS\r\n *\r\n *    Date              Description\r\n *    ----              -----------\r\n *    25-02-97          Original Code\r\n *\r\n */\r\n\r\n\r\n#ifndef BOOST_GEOMETRY_SRS_PROJECTIONS_IMPL_GEOCENT_HPP\r\n#define BOOST_GEOMETRY_SRS_PROJECTIONS_IMPL_GEOCENT_HPP\r\n\r\n\r\n#include <boost/geometry/util/math.hpp>\r\n\r\n\r\nnamespace boost { namespace geometry { namespace projections\r\n{\r\n\r\nnamespace detail\r\n{\r\n\r\n/***************************************************************************/\r\n/*\r\n *                               DEFINES\r\n */\r\nstatic const long GEOCENT_NO_ERROR       = 0x0000;\r\nstatic const long GEOCENT_LAT_ERROR      = 0x0001;\r\nstatic const long GEOCENT_LON_ERROR      = 0x0002;\r\nstatic const long GEOCENT_A_ERROR        = 0x0004;\r\nstatic const long GEOCENT_B_ERROR        = 0x0008;\r\nstatic const long GEOCENT_A_LESS_B_ERROR = 0x0010;\r\n\r\ntemplate <typename T>\r\nstruct GeocentricInfo\r\n{\r\n    T Geocent_a;        /* Semi-major axis of ellipsoid in meters */\r\n    T Geocent_b;        /* Semi-minor axis of ellipsoid           */\r\n    T Geocent_a2;       /* Square of semi-major axis */\r\n    T Geocent_b2;       /* Square of semi-minor axis */\r\n    T Geocent_e2;       /* Eccentricity squared  */\r\n    T Geocent_ep2;      /* 2nd eccentricity squared */\r\n};\r\n\r\ntemplate <typename T>\r\ninline T COS_67P5()\r\n{\r\n    /*return 0.38268343236508977*/;\r\n    return cos(T(67.5) * math::d2r<T>());  /* cosine of 67.5 degrees */\r\n}\r\ntemplate <typename T>\r\ninline T AD_C()\r\n{\r\n    return 1.0026000;            /* Toms region 1 constant */\r\n}\r\n\r\n\r\n/***************************************************************************/\r\n/*\r\n *                              FUNCTIONS     \r\n */\r\n\r\ntemplate <typename T>\r\ninline long pj_Set_Geocentric_Parameters (GeocentricInfo<T> & gi, T const& a, T const& b) \r\n\r\n{ /* BEGIN Set_Geocentric_Parameters */\r\n/*\r\n * The function Set_Geocentric_Parameters receives the ellipsoid parameters\r\n * as inputs and sets the corresponding state variables.\r\n *\r\n *    a  : Semi-major axis, in meters.          (input)\r\n *    b  : Semi-minor axis, in meters.          (input)\r\n */\r\n    long Error_Code = GEOCENT_NO_ERROR;\r\n\r\n    if (a <= 0.0)\r\n        Error_Code |= GEOCENT_A_ERROR;\r\n    if (b <= 0.0)\r\n        Error_Code |= GEOCENT_B_ERROR;\r\n    if (a < b)\r\n        Error_Code |= GEOCENT_A_LESS_B_ERROR;\r\n    if (!Error_Code)\r\n    {\r\n        gi.Geocent_a = a;\r\n        gi.Geocent_b = b;\r\n        gi.Geocent_a2 = a * a;\r\n        gi.Geocent_b2 = b * b;\r\n        gi.Geocent_e2 = (gi.Geocent_a2 - gi.Geocent_b2) / gi.Geocent_a2;\r\n        gi.Geocent_ep2 = (gi.Geocent_a2 - gi.Geocent_b2) / gi.Geocent_b2;\r\n    }\r\n    return (Error_Code);\r\n} /* END OF Set_Geocentric_Parameters */\r\n\r\n\r\ntemplate <typename T>\r\ninline void pj_Get_Geocentric_Parameters (GeocentricInfo<T> const& gi,\r\n                                          T & a, \r\n                                          T & b)\r\n{ /* BEGIN Get_Geocentric_Parameters */\r\n/*\r\n * The function Get_Geocentric_Parameters returns the ellipsoid parameters\r\n * to be used in geocentric coordinate conversions.\r\n *\r\n *    a  : Semi-major axis, in meters.          (output)\r\n *    b  : Semi-minor axis, in meters.          (output)\r\n */\r\n\r\n    a = gi.Geocent_a;\r\n    b = gi.Geocent_b;\r\n} /* END OF Get_Geocentric_Parameters */\r\n\r\n\r\ntemplate <typename T>\r\ninline long pj_Convert_Geodetic_To_Geocentric (GeocentricInfo<T> const& gi,\r\n                                               T Longitude, T Latitude, T Height,\r\n                                               T & X, T & Y, T & Z)\r\n{ /* BEGIN Convert_Geodetic_To_Geocentric */\r\n/*\r\n * The function Convert_Geodetic_To_Geocentric converts geodetic coordinates\r\n * (latitude, longitude, and height) to geocentric coordinates (X, Y, Z),\r\n * according to the current ellipsoid parameters.\r\n *\r\n *    Latitude  : Geodetic latitude in radians                     (input)\r\n *    Longitude : Geodetic longitude in radians                    (input)\r\n *    Height    : Geodetic height, in meters                       (input)\r\n *    X         : Calculated Geocentric X coordinate, in meters    (output)\r\n *    Y         : Calculated Geocentric Y coordinate, in meters    (output)\r\n *    Z         : Calculated Geocentric Z coordinate, in meters    (output)\r\n *\r\n */\r\n  long Error_Code = GEOCENT_NO_ERROR;\r\n  T Rn;            /*  Earth radius at location  */\r\n  T Sin_Lat;       /*  sin(Latitude)  */\r\n  T Sin2_Lat;      /*  Square of sin(Latitude)  */\r\n  T Cos_Lat;       /*  cos(Latitude)  */\r\n\r\n  static const T PI = math::pi<T>();\r\n  static const T PI_OVER_2 = math::half_pi<T>();\r\n\r\n  /*\r\n  ** Don't blow up if Latitude is just a little out of the value\r\n  ** range as it may just be a rounding issue.  Also removed longitude\r\n  ** test, it should be wrapped by cos() and sin().  NFW for PROJ.4, Sep/2001.\r\n  */\r\n  if( Latitude < -PI_OVER_2 && Latitude > -1.001 * PI_OVER_2 )\r\n      Latitude = -PI_OVER_2;\r\n  else if( Latitude > PI_OVER_2 && Latitude < 1.001 * PI_OVER_2 )\r\n      Latitude = PI_OVER_2;\r\n  else if ((Latitude < -PI_OVER_2) || (Latitude > PI_OVER_2))\r\n  { /* Latitude out of range */\r\n    Error_Code |= GEOCENT_LAT_ERROR;\r\n  }\r\n\r\n  if (!Error_Code)\r\n  { /* no errors */\r\n    if (Longitude > PI)\r\n      Longitude -= (2*PI);\r\n    Sin_Lat = sin(Latitude);\r\n    Cos_Lat = cos(Latitude);\r\n    Sin2_Lat = Sin_Lat * Sin_Lat;\r\n    Rn = gi.Geocent_a / (sqrt(1.0e0 - gi.Geocent_e2 * Sin2_Lat));\r\n    X = (Rn + Height) * Cos_Lat * cos(Longitude);\r\n    Y = (Rn + Height) * Cos_Lat * sin(Longitude);\r\n    Z = ((Rn * (1 - gi.Geocent_e2)) + Height) * Sin_Lat;\r\n  }\r\n  return (Error_Code);\r\n} /* END OF Convert_Geodetic_To_Geocentric */\r\n\r\n/*\r\n * The function Convert_Geocentric_To_Geodetic converts geocentric\r\n * coordinates (X, Y, Z) to geodetic coordinates (latitude, longitude, \r\n * and height), according to the current ellipsoid parameters.\r\n *\r\n *    X         : Geocentric X coordinate, in meters.         (input)\r\n *    Y         : Geocentric Y coordinate, in meters.         (input)\r\n *    Z         : Geocentric Z coordinate, in meters.         (input)\r\n *    Latitude  : Calculated latitude value in radians.       (output)\r\n *    Longitude : Calculated longitude value in radians.      (output)\r\n *    Height    : Calculated height value, in meters.         (output)\r\n */\r\n\r\n#define BOOST_GEOMETRY_PROJECTIONS_USE_ITERATIVE_METHOD\r\n\r\ntemplate <typename T>\r\ninline void pj_Convert_Geocentric_To_Geodetic (GeocentricInfo<T> const& gi,\r\n                                               T X, T Y, T Z,\r\n                                               T & Longitude, T & Latitude, T & Height)\r\n{ /* BEGIN Convert_Geocentric_To_Geodetic */\r\n\r\n    static const T PI_OVER_2 = math::half_pi<T>();\r\n\r\n#if !defined(BOOST_GEOMETRY_PROJECTIONS_USE_ITERATIVE_METHOD)\r\n\r\n    static const T COS_67P5 = detail::COS_67P5<T>();\r\n    static const T AD_C = detail::AD_C<T>();\r\n\r\n/*\r\n * The method used here is derived from 'An Improved Algorithm for\r\n * Geocentric to Geodetic Coordinate Conversion', by Ralph Toms, Feb 1996\r\n */\r\n\r\n/* Note: Variable names follow the notation used in Toms, Feb 1996 */\r\n\r\n    T W;        /* distance from Z axis */\r\n    T W2;       /* square of distance from Z axis */\r\n    T T0;       /* initial estimate of vertical component */\r\n    T T1;       /* corrected estimate of vertical component */\r\n    T S0;       /* initial estimate of horizontal component */\r\n    T S1;       /* corrected estimate of horizontal component */\r\n    T Sin_B0;   /* sin(B0), B0 is estimate of Bowring aux variable */\r\n    T Sin3_B0;  /* cube of sin(B0) */\r\n    T Cos_B0;   /* cos(B0) */\r\n    T Sin_p1;   /* sin(phi1), phi1 is estimated latitude */\r\n    T Cos_p1;   /* cos(phi1) */\r\n    T Rn;       /* Earth radius at location */\r\n    T Sum;      /* numerator of cos(phi1) */\r\n    bool At_Pole;     /* indicates location is in polar region */\r\n\r\n    At_Pole = false;\r\n    if (X != 0.0)\r\n    {\r\n        Longitude = atan2(Y,X);\r\n    }\r\n    else\r\n    {\r\n        if (Y > 0)\r\n        {\r\n            Longitude = PI_OVER_2;\r\n        }\r\n        else if (Y < 0)\r\n        {\r\n            Longitude = -PI_OVER_2;\r\n        }\r\n        else\r\n        {\r\n            At_Pole = true;\r\n            Longitude = 0.0;\r\n            if (Z > 0.0)\r\n            {  /* north pole */\r\n                Latitude = PI_OVER_2;\r\n            }\r\n            else if (Z < 0.0)\r\n            {  /* south pole */\r\n                Latitude = -PI_OVER_2;\r\n            }\r\n            else\r\n            {  /* center of earth */\r\n                Latitude = PI_OVER_2;\r\n                Height = -Geocent_b;\r\n                return;\r\n            } \r\n        }\r\n    }\r\n    W2 = X*X + Y*Y;\r\n    W = sqrt(W2);\r\n    T0 = Z * AD_C;\r\n    S0 = sqrt(T0 * T0 + W2);\r\n    Sin_B0 = T0 / S0;\r\n    Cos_B0 = W / S0;\r\n    Sin3_B0 = Sin_B0 * Sin_B0 * Sin_B0;\r\n    T1 = Z + gi.Geocent_b * gi.Geocent_ep2 * Sin3_B0;\r\n    Sum = W - gi.Geocent_a * gi.Geocent_e2 * Cos_B0 * Cos_B0 * Cos_B0;\r\n    S1 = sqrt(T1*T1 + Sum * Sum);\r\n    Sin_p1 = T1 / S1;\r\n    Cos_p1 = Sum / S1;\r\n    Rn = gi.Geocent_a / sqrt(1.0 - gi.Geocent_e2 * Sin_p1 * Sin_p1);\r\n    if (Cos_p1 >= COS_67P5)\r\n    {\r\n        Height = W / Cos_p1 - Rn;\r\n    }\r\n    else if (Cos_p1 <= -COS_67P5)\r\n    {\r\n        Height = W / -Cos_p1 - Rn;\r\n    }\r\n    else\r\n    {\r\n        Height = Z / Sin_p1 + Rn * (gi.Geocent_e2 - 1.0);\r\n    }\r\n    if (At_Pole == false)\r\n    {\r\n        Latitude = atan(Sin_p1 / Cos_p1);\r\n    }\r\n#else /* defined(BOOST_GEOMETRY_PROJECTIONS_USE_ITERATIVE_METHOD) */\r\n/*\r\n* Reference...\r\n* ============\r\n* Wenzel, H.-G.(1985): Hochauflösende Kugelfunktionsmodelle für\r\n* das Gravitationspotential der Erde. Wiss. Arb. Univ. Hannover\r\n* Nr. 137, p. 130-131.\r\n\r\n* Programmed by GGA- Leibniz-Institute of Applied Geophysics\r\n*               Stilleweg 2\r\n*               D-30655 Hannover\r\n*               Federal Republic of Germany\r\n*               Internet: www.gga-hannover.de\r\n*\r\n*               Hannover, March 1999, April 2004.\r\n*               see also: comments in statements\r\n* remarks:\r\n* Mathematically exact and because of symmetry of rotation-ellipsoid,\r\n* each point (X,Y,Z) has at least two solutions (Latitude1,Longitude1,Height1) and\r\n* (Latitude2,Longitude2,Height2). Is point=(0.,0.,Z) (P=0.), so you get even\r\n* four solutions,\tevery two symmetrical to the semi-minor axis.\r\n* Here Height1 and Height2 have at least a difference in order of\r\n* radius of curvature (e.g. (0,0,b)=> (90.,0.,0.) or (-90.,0.,-2b);\r\n* (a+100.)*(sqrt(2.)/2.,sqrt(2.)/2.,0.) => (0.,45.,100.) or\r\n* (0.,225.,-(2a+100.))).\r\n* The algorithm always computes (Latitude,Longitude) with smallest |Height|.\r\n* For normal computations, that means |Height|<10000.m, algorithm normally\r\n* converges after to 2-3 steps!!!\r\n* But if |Height| has the amount of length of ellipsoid's axis\r\n* (e.g. -6300000.m),\talgorithm needs about 15 steps.\r\n*/\r\n\r\n/* local definitions and variables */\r\n/* end-criterium of loop, accuracy of sin(Latitude) */\r\nstatic const T genau   = 1.E-12;\r\nstatic const T genau2  = (genau*genau);\r\nstatic const int maxiter = 30;\r\n\r\n    T P;        /* distance between semi-minor axis and location */\r\n    T RR;       /* distance between center and location */\r\n    T CT;       /* sin of geocentric latitude */\r\n    T ST;       /* cos of geocentric latitude */\r\n    T RX;\r\n    T RK;\r\n    T RN;       /* Earth radius at location */\r\n    T CPHI0;    /* cos of start or old geodetic latitude in iterations */\r\n    T SPHI0;    /* sin of start or old geodetic latitude in iterations */\r\n    T CPHI;     /* cos of searched geodetic latitude */\r\n    T SPHI;     /* sin of searched geodetic latitude */\r\n    T SDPHI;    /* end-criterium: addition-theorem of sin(Latitude(iter)-Latitude(iter-1)) */\r\n    int iter;   /* # of continuous iteration, max. 30 is always enough (s.a.) */\r\n\r\n    P = sqrt(X*X+Y*Y);\r\n    RR = sqrt(X*X+Y*Y+Z*Z);\r\n\r\n/*\tspecial cases for latitude and longitude */\r\n    if (P/gi.Geocent_a < genau) {\r\n\r\n/*  special case, if P=0. (X=0., Y=0.) */\r\n\tLongitude = 0.;\r\n\r\n/*  if (X,Y,Z)=(0.,0.,0.) then Height becomes semi-minor axis\r\n *  of ellipsoid (=center of mass), Latitude becomes PI/2 */\r\n        if (RR/gi.Geocent_a < genau) {\r\n            Latitude = PI_OVER_2;\r\n            Height   = -gi.Geocent_b;\r\n            return ;\r\n\r\n        }\r\n    }\r\n    else {\r\n/*  ellipsoidal (geodetic) longitude\r\n *  interval: -PI < Longitude <= +PI */\r\n        Longitude=atan2(Y,X);\r\n    }\r\n\r\n/* --------------------------------------------------------------\r\n * Following iterative algorithm was developed by\r\n * \"Institut für Erdmessung\", University of Hannover, July 1988.\r\n * Internet: www.ife.uni-hannover.de\r\n * Iterative computation of CPHI,SPHI and Height.\r\n * Iteration of CPHI and SPHI to 10**-12 radian resp.\r\n * 2*10**-7 arcsec.\r\n * --------------------------------------------------------------\r\n */\r\n    CT = Z/RR;\r\n    ST = P/RR;\r\n    RX = 1.0/sqrt(1.0-gi.Geocent_e2*(2.0-gi.Geocent_e2)*ST*ST);\r\n    CPHI0 = ST*(1.0-gi.Geocent_e2)*RX;\r\n    SPHI0 = CT*RX;\r\n    iter = 0;\r\n\r\n/* loop to find sin(Latitude) resp. Latitude\r\n * until |sin(Latitude(iter)-Latitude(iter-1))| < genau */\r\n    do\r\n    {\r\n        iter++;\r\n        RN = gi.Geocent_a/sqrt(1.0-gi.Geocent_e2*SPHI0*SPHI0);\r\n\r\n/*  ellipsoidal (geodetic) height */\r\n        Height = P*CPHI0+Z*SPHI0-RN*(1.0-gi.Geocent_e2*SPHI0*SPHI0);\r\n\r\n        RK = gi.Geocent_e2*RN/(RN+Height);\r\n        RX = 1.0/sqrt(1.0-RK*(2.0-RK)*ST*ST);\r\n        CPHI = ST*(1.0-RK)*RX;\r\n        SPHI = CT*RX;\r\n        SDPHI = SPHI*CPHI0-CPHI*SPHI0;\r\n        CPHI0 = CPHI;\r\n        SPHI0 = SPHI;\r\n    }\r\n    while (SDPHI*SDPHI > genau2 && iter < maxiter);\r\n\r\n/*\tellipsoidal (geodetic) latitude */\r\n    Latitude=atan(SPHI/fabs(CPHI));\r\n\r\n    return;\r\n#endif /* defined(BOOST_GEOMETRY_PROJECTIONS_USE_ITERATIVE_METHOD) */\r\n} /* END OF Convert_Geocentric_To_Geodetic */\r\n\r\n\r\n} // namespace detail\r\n\r\n\r\n}}} // namespace boost::geometry::projections\r\n\r\n\r\n#endif // BOOST_GEOMETRY_SRS_PROJECTIONS_IMPL_GEOCENT_HPP\r\n", "meta": {"hexsha": "cafa064f5a08c792e9bf59cd813b68c0da2990d0", "size": 16874, "ext": "hpp", "lang": "C++", "max_stars_repo_path": "deps/boost/include/boost/geometry/srs/projections/impl/geocent.hpp", "max_stars_repo_name": "kindlychung/mediasoup-sfu-cpp", "max_stars_repo_head_hexsha": "f69d2f48f7edbf4f0c57244280a47bea985f39cf", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 995.0, "max_stars_repo_stars_event_min_datetime": "2018-06-22T10:39:18.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-25T01:22:14.000Z", "max_issues_repo_path": "deps/boost/include/boost/geometry/srs/projections/impl/geocent.hpp", "max_issues_repo_name": "kindlychung/mediasoup-sfu-cpp", "max_issues_repo_head_hexsha": "f69d2f48f7edbf4f0c57244280a47bea985f39cf", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": 32.0, "max_issues_repo_issues_event_min_datetime": "2018-06-23T14:19:37.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-29T10:20:37.000Z", "max_forks_repo_path": "deps/boost/include/boost/geometry/srs/projections/impl/geocent.hpp", "max_forks_repo_name": "kindlychung/mediasoup-sfu-cpp", "max_forks_repo_head_hexsha": "f69d2f48f7edbf4f0c57244280a47bea985f39cf", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": 172.0, "max_forks_repo_forks_event_min_datetime": "2018-06-22T11:12:00.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-29T07:44:33.000Z", "avg_line_length": 34.5778688525, "max_line_length": 94, "alphanum_fraction": 0.5723005808, "num_tokens": 4617, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO", "lm_q1_score": 0.5312093733737562, "lm_q2_score": 0.24220563419533916, "lm_q1q2_score": 0.12866190316849932}}
{"text": "// Boost.Geometry (aka GGL, Generic Geometry Library)\r\n// This file is manually converted from PROJ4\r\n\r\n// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.\r\n\r\n// This file was modified by Oracle on 2017, 2018, 2019.\r\n// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.\r\n// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle\r\n\r\n// Use, modification and distribution is subject to the Boost Software License,\r\n// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at\r\n// http://www.boost.org/LICENSE_1_0.txt)\r\n\r\n// This file is converted from PROJ4, http://trac.osgeo.org/proj\r\n// PROJ4 is originally written by Gerald Evenden (then of the USGS)\r\n// PROJ4 is maintained by Frank Warmerdam\r\n// PROJ4 is converted to Geometry Library by Barend Gehrels (Geodan, Amsterdam)\r\n\r\n// Original copyright notice:\r\n\r\n// Permission is hereby granted, free of charge, to any person obtaining a\r\n// copy of this software and associated documentation files (the \"Software\"),\r\n// to deal in the Software without restriction, including without limitation\r\n// the rights to use, copy, modify, merge, publish, distribute, sublicense,\r\n// and/or sell copies of the Software, and to permit persons to whom the\r\n// Software is furnished to do so, subject to the following conditions:\r\n\r\n// The above copyright notice and this permission notice shall be included\r\n// in all copies or substantial portions of the Software.\r\n\r\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\r\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\r\n// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\r\n// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\r\n// DEALINGS IN THE SOFTWARE.\r\n\r\n#ifndef BOOST_GEOMETRY_PROJECTIONS_IMPL_PJ_FWD_HPP\r\n#define BOOST_GEOMETRY_PROJECTIONS_IMPL_PJ_FWD_HPP\r\n\r\n#include <boost/geometry/core/radian_access.hpp>\r\n#include <boost/geometry/util/math.hpp>\r\n\r\n#include <boost/geometry/srs/projections/impl/adjlon.hpp>\r\n#include <boost/geometry/srs/projections/impl/projects.hpp>\r\n\r\n#include <boost/math/constants/constants.hpp>\r\n\r\n/* general forward projection */\r\n\r\nnamespace boost { namespace geometry { namespace projections {\r\n\r\nnamespace detail {\r\n\r\n/* forward projection entry */\r\ntemplate <typename Prj, typename LL, typename XY, typename P>\r\ninline void pj_fwd(Prj const& prj, P const& par, LL const& ll, XY& xy)\r\n{\r\n    typedef typename P::type calc_t;\r\n    static const calc_t EPS = 1.0e-12;\r\n\r\n    using namespace detail;\r\n\r\n    calc_t lp_lon = geometry::get_as_radian<0>(ll);\r\n    calc_t lp_lat = geometry::get_as_radian<1>(ll);\r\n    calc_t const t = geometry::math::abs(lp_lat) - geometry::math::half_pi<calc_t>();\r\n\r\n    /* check for forward and latitude or longitude overange */\r\n    if (t > EPS || geometry::math::abs(lp_lon) > 10.)\r\n    {\r\n        BOOST_THROW_EXCEPTION( projection_exception(error_lat_or_lon_exceed_limit) );\r\n    }\r\n\r\n    if (geometry::math::abs(t) <= EPS)\r\n    {\r\n        lp_lat = lp_lat < 0. ? -geometry::math::half_pi<calc_t>() : geometry::math::half_pi<calc_t>();\r\n    }\r\n    else if (par.geoc)\r\n    {\r\n        lp_lat = atan(par.rone_es * tan(lp_lat));\r\n    }\r\n\r\n    lp_lon -= par.lam0;    /* compute del lp.lam */\r\n    if (! par.over)\r\n    {\r\n        lp_lon = adjlon(lp_lon); /* post_forward del longitude */\r\n    }\r\n\r\n    calc_t x = 0;\r\n    calc_t y = 0;\r\n\r\n    prj.fwd(par, lp_lon, lp_lat, x, y);\r\n\r\n    geometry::set<0>(xy, par.fr_meter * (par.a * x + par.x0));\r\n    geometry::set<1>(xy, par.fr_meter * (par.a * y + par.y0));\r\n}\r\n\r\n} // namespace detail\r\n}}} // namespace boost::geometry::projections\r\n\r\n#endif // BOOST_GEOMETRY_PROJECTIONS_IMPL_PJ_FWD_HPP\r\n", "meta": {"hexsha": "33cbde3ff6099b82c3acd7888a6ff4aacc239b9c", "size": 3896, "ext": "hpp", "lang": "C++", "max_stars_repo_path": "deps/boost/include/boost/geometry/srs/projections/impl/pj_fwd.hpp", "max_stars_repo_name": "kindlychung/mediasoup-sfu-cpp", "max_stars_repo_head_hexsha": "f69d2f48f7edbf4f0c57244280a47bea985f39cf", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 80.0, "max_stars_repo_stars_event_min_datetime": "2021-09-07T12:44:32.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-29T01:22:19.000Z", "max_issues_repo_path": "deps/boost/include/boost/geometry/srs/projections/impl/pj_fwd.hpp", "max_issues_repo_name": "kindlychung/mediasoup-sfu-cpp", "max_issues_repo_head_hexsha": "f69d2f48f7edbf4f0c57244280a47bea985f39cf", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": 2.0, "max_issues_repo_issues_event_min_datetime": "2021-12-23T02:49:42.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-15T05:28:24.000Z", "max_forks_repo_path": "deps/boost/include/boost/geometry/srs/projections/impl/pj_fwd.hpp", "max_forks_repo_name": "kindlychung/mediasoup-sfu-cpp", "max_forks_repo_head_hexsha": "f69d2f48f7edbf4f0c57244280a47bea985f39cf", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": 25.0, "max_forks_repo_forks_event_min_datetime": "2021-09-14T06:24:25.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-20T06:55:07.000Z", "avg_line_length": 37.8252427184, "max_line_length": 103, "alphanum_fraction": 0.7017453799, "num_tokens": 956, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO\n\n", "lm_q1_score": 0.5428632831725052, "lm_q2_score": 0.2200070997458932, "lm_q1q2_score": 0.11943377648931641}}