Skip to content

Commit

Permalink
Workon P0
Browse files Browse the repository at this point in the history
  • Loading branch information
cbritopacheco committed Nov 5, 2023
1 parent eb77d53 commit 0c03b74
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 6 deletions.
30 changes: 30 additions & 0 deletions examples/Variational/P0/ScalarP0Projection.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright Carlos BRITO PACHECO 2021 - 2022.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE or copy at
* https://www.boost.org/LICENSE_1_0.txt)
*/
#include <Rodin/Solver.h>
#include <Rodin/Geometry.h>
#include <Rodin/Variational.h>

using namespace Rodin;
using namespace Rodin::Geometry;
using namespace Rodin::Variational;

int main(int, char**)
{
Mesh mesh;
mesh = mesh.UniformGrid(Polytope::Type::Triangle, 32, 32);

P0 fes(mesh);
GridFunction gf(fes);

gf = [](const Geometry::Point& p) { return p.x() * p.x() + p.y() * p.y(); };

mesh.save("Projection.mesh");
gf.save("Projection.gf");
}



10 changes: 5 additions & 5 deletions src/Rodin/Geometry/Mesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ namespace Rodin::Geometry
/**
* @brief Adds vertex with coordinates given by the fixed size array.
*
* This method requires nodes(size_t) to be called beforehand.
* @note This method requires nodes(size_t) to be called beforehand.
*/
template <size_t Size>
inline
Expand All @@ -534,28 +534,28 @@ namespace Rodin::Geometry
/**
* @brief Adds vertex with coordinates given by the initializer list.
*
* This method requires nodes(size_t) to be called beforehand.
* @note This method requires nodes(size_t) to be called beforehand.
*/
Builder& vertex(std::initializer_list<Scalar> l);

/**
* @brief Adds vertex with coordinates given by the array pointer.
*
* This method requires nodes(size_t) to be called beforehand.
* @note This method requires nodes(size_t) to be called beforehand.
*/
Builder& vertex(const Scalar* data);

/**
* @brief Adds vertex with coordinates given by the mapped memory.
*
* This method requires nodes(size_t) to be called beforehand.
* @note This method requires nodes(size_t) to be called beforehand.
*/
Builder& vertex(const Eigen::Map<const Math::Vector>& x);

/**
* @brief Adds vertex with coordinates given by the vector.
*
* This method requires nodes(size_t) to be called beforehand.
* @note This method requires nodes(size_t) to be called beforehand.
*/
Builder& vertex(Math::Vector&& x);

Expand Down
4 changes: 3 additions & 1 deletion src/Rodin/Variational.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,12 @@
#include "Variational/MatrixFunction.h"
#include "Variational/BooleanFunction.h"

#include "Variational/P0.h"
#include "Variational/P1.h"

#include "Variational/DirichletBC.h"
#include "Variational/PeriodicBC.h"

#include "Variational/P1.h"
#include "Variational/Potential.h"

#endif
9 changes: 9 additions & 0 deletions src/Rodin/Variational/P0.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#ifndef RODIN_VARIATIONAL_P0_H
#define RODIN_VARIATIONAL_P0_H

#include "P0/P0.h"
#include "P0/P0Element.h"
#include "P0/GridFunction.h"

#endif

0 comments on commit 0c03b74

Please sign in to comment.