Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jmanzanero committed Nov 20, 2023
2 parents 9c48178 + 4dc0fdf commit 5829271
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
4 changes: 4 additions & 0 deletions lion/foundation/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ constexpr T smooth_step(const T &x, S eps);
template <typename T>
constexpr std::vector<T> linspace(T lo, T hi, std::size_t num_points);

template<typename T>
constexpr std::vector<T> iota(T lo, std::size_t num_points, T increment = T{ 1 });


template<typename T>
inline T trapz(const std::vector<T>& x, const std::vector<T>& y);

Expand Down
19 changes: 19 additions & 0 deletions lion/foundation/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,25 @@ constexpr std::vector<T> linspace(T lo, T hi, std::size_t num_points)
}


template<typename T>
constexpr std::vector<T> iota(T lo, std::size_t num_points, T increment)
{
//
// Returns a vector of size "num_points" whose first
// element is equal to "lo" and its rest of elements
// are sequentially increased by "increment".
//

std::vector<T> ret(num_points);
for (auto &&r : ret) {
r = lo;
lo += increment;
}

return ret;
}


template<typename T>
inline T trapz(const std::vector<T>& x, const std::vector<T>& y)
{
Expand Down
2 changes: 1 addition & 1 deletion lion/io/Xml_document.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef __XML_DOCUMENT_H__
#define __XML_DOCUMENT_H__

#include "lion/thirdparty/include/tinyxml2.h"
#include "tinyxml2.h"

#include "Xml_element.h"

Expand Down
5 changes: 3 additions & 2 deletions lion/io/Xml_element.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#ifndef __XML_ELEMENT_H__
#define __XML_ELEMENT_H__

#include "lion/thirdparty/include/tinyxml2.h"
#include "tinyxml2.h"

#include "lion/thirdparty/include/logger.hpp"
#include "lion/foundation/utils.hpp"
#include "lion/math/vector3d.hpp"
#include "lion/math/matrix3x3.h"
#include "lion/math/matrix_extensions.h"
#include "lion/thirdparty/include/logger.hpp"

class Xml_element
{
Expand Down

0 comments on commit 5829271

Please sign in to comment.