Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

energy #350

Merged
merged 159 commits into from
Oct 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
159 commits
Select commit Hold shift + click to select a range
b451e29
Merge branch 'main' of https://github.com/wildmeshing/wildmeshing-too…
yunfanzhou Jun 7, 2023
340447e
Merge branch 'main' of https://github.com/wildmeshing/wildmeshing-too…
yunfanzhou Aug 22, 2023
e3b0f64
AMIPS first draft
yunfanzhou Aug 22, 2023
965171b
Merge branch 'hackathon/dev' of https://github.com/wildmeshing/wildme…
yunfanzhou Aug 27, 2023
b57e5a3
adding cmake, changing to templated evaluation in child classes. not…
yunfanzhou Aug 28, 2023
c764b92
added autodiff
yunfanzhou Aug 28, 2023
4c526ec
small error on boundary swap cost
yunfanzhou Aug 29, 2023
12e3765
valence energy for trimesh
yunfanzhou Aug 29, 2023
cf2c6db
add deconstructor to energy. allow m_mesh casting between mesh to chi…
yunfanzhou Aug 29, 2023
c25a803
util function for casting between autodiff type and double
yunfanzhou Aug 29, 2023
fa2006c
AMIPS compiled
yunfanzhou Aug 29, 2023
2073774
add trimesh as a field for ValenceEnergy
yunfanzhou Aug 30, 2023
334e570
AMIPS init with trimesh
yunfanzhou Aug 30, 2023
a1055bc
Merge branch 'hackathon/dev' of https://github.com/wildmeshing/wildme…
yunfanzhou Aug 30, 2023
088a851
AccuracyError with constructor
yunfanzhou Aug 31, 2023
7d6b99d
change valence energy defition and naming
yunfanzhou Aug 31, 2023
bb06bb5
test for valence energy
yunfanzhou Aug 31, 2023
5dc0904
update trimesh example generating for new examples
yunfanzhou Aug 31, 2023
216b6c5
tests changed name to test_2d_energy. valence energy test is done
yunfanzhou Aug 31, 2023
a95ab0e
differentiable energy update
yunfanzhou Aug 31, 2023
0e60bb5
making autodiff link
mtao Aug 31, 2023
aaac289
Merge https://github.com/wildmeshing/wildmeshing-toolkit into hacktho…
yunfanzhou Sep 1, 2023
27d0fe3
Merge branch 'hackthon/yunfan/energy' of https://github.com/wildmeshi…
yunfanzhou Sep 1, 2023
6d56aff
amips test for equilateral traingle done
yunfanzhou Sep 1, 2023
5357e72
dof to position filler
yunfanzhou Sep 1, 2023
484434f
AMIPS 3d with dummy filler for get position
yunfanzhou Sep 1, 2023
b6d18ca
test for amips 3d using double type
yunfanzhou Sep 1, 2023
e355cf4
port in image and smapling. compiled
yunfanzhou Sep 5, 2023
af372b7
new dofstoposition and sampling with analytic function and templated …
yunfanzhou Sep 6, 2023
058825f
using the new sampling method for Amips3D. Rewrite testing. Not compi…
yunfanzhou Sep 6, 2023
3ac1972
change samplingImage to samplingBicubic
yunfanzhou Sep 6, 2023
1ab67d5
fix some compiation problme still not compiling
yunfanzhou Sep 6, 2023
6797165
changing sampling and dof to pos to not expose autodiff type
yunfanzhou Sep 7, 2023
c5f148d
using the new dofs to pos and smapling method for amips 3d
yunfanzhou Sep 7, 2023
41e877d
small type changes. Compiles
yunfanzhou Sep 7, 2023
b61bbb4
constructor for new SamplingAnalyticFunction
yunfanzhou Sep 7, 2023
8955b25
change AMIPS 3d constructor . Chnage ConstMapType data ordering
yunfanzhou Sep 7, 2023
f10afb3
Merge branch 'hackathon/dev' into hackthon/yunfan/energy
mtao Sep 10, 2023
c2ed59d
initial stab at selfhosted runners
mtao Sep 7, 2023
4cdb69a
second stab at updating actions for self-runner
mtao Sep 8, 2023
33131c5
trying minor indentation fix on actions workflow
mtao Sep 8, 2023
830f5f0
Update continuous.yml for linux
mtao Sep 8, 2023
03b420f
Update continuous.yml for mac
mtao Sep 8, 2023
061c5b0
Update continuous.yml to use arm64 instead of ARM64
mtao Sep 8, 2023
fb161cf
Update continuous.yml -- windows fix
danielepanozzo Sep 8, 2023
a1ad942
updating doxygen build to not install
mtao Sep 8, 2023
5d98ca8
Update continuous.yml -- windows fix without cache
danielepanozzo Sep 8, 2023
88eb486
Update continuous.yml -- fix windows tests
danielepanozzo Sep 8, 2023
3dae6db
fix IDE groups
daniel-zint Sep 10, 2023
66ad470
inheritance based accessors works
mtao Sep 10, 2023
f51d0e9
fixing compilation errors from merge
mtao Sep 10, 2023
e0eb32b
terrible bug fix
zlyfunction Sep 11, 2023
12d3cad
adding ability for mesh to return an attribute\'s dimension
mtao Sep 12, 2023
13a1981
throw an error if perl is not installed
daniel-zint Sep 11, 2023
7ed7075
adding cmake, changing to templated evaluation in child classes. not…
yunfanzhou Aug 28, 2023
2dee27e
port in image and smapling. compiled
yunfanzhou Sep 5, 2023
1afce58
energy refactor to function. Adding AutodiffFunction and use attri ha…
yunfanzhou Sep 12, 2023
6e598ff
add tests for AMIPS2d. compilation details
yunfanzhou Sep 12, 2023
7d3bdd5
Merge branch 'hackathon/dev' of https://github.com/wildmeshing/wildme…
yunfanzhou Sep 12, 2023
d45def4
small changes for compilation of AMIPS
yunfanzhou Sep 13, 2023
151197d
traingle area helper functions in utils
yunfanzhou Sep 13, 2023
81198b0
add trinagle inversion invariants
yunfanzhou Sep 13, 2023
10e13dc
add inversion check in smooth base operation
yunfanzhou Sep 14, 2023
e9cadbe
VertexSmoothing using diff energy
yunfanzhou Sep 14, 2023
89154e8
triangle helper function cmake
yunfanzhou Sep 14, 2023
5d9a884
amips3d test
yunfanzhou Sep 14, 2023
f395b98
test for random traingle on amips energy
yunfanzhou Sep 14, 2023
132f61f
Merge branch 'hackathon/dev' of https://github.com/wildmeshing/wildme…
yunfanzhou Sep 19, 2023
e028827
add triangle inversion invariants
yunfanzhou Sep 19, 2023
dd96ea0
add modified primitives for vertex smooth> only has modified faces fo…
yunfanzhou Sep 19, 2023
5c3fe4d
helper function for optimization. probably not useful in the end
yunfanzhou Sep 19, 2023
6e5e29e
vertex smoothing that uses energy optimization
yunfanzhou Sep 19, 2023
329cbe0
test with trimesh examples
yunfanzhou Sep 20, 2023
91e83cd
structure for line search
yunfanzhou Sep 20, 2023
80227d4
change vertex smooth to be the parent class
yunfanzhou Sep 20, 2023
846cd4c
vertex smoothing newton method with line search
yunfanzhou Sep 20, 2023
349840e
bounadry situation not implemented
yunfanzhou Sep 20, 2023
421dc36
Merge branch 'hackathon/dev' of https://github.com/wildmeshing/wildme…
yunfanzhou Sep 22, 2023
b4a29f1
scheduler with operation factory specific for an operation
yunfanzhou Sep 27, 2023
3a186f5
small changes for operations
yunfanzhou Sep 27, 2023
f9fa357
the triangles with positions
yunfanzhou Sep 27, 2023
a8ff171
smoothing test
yunfanzhou Sep 27, 2023
2e6047d
Merge branch 'hackathon/dev' of https://github.com/wildmeshing/wildme…
yunfanzhou Sep 27, 2023
266f55c
Merge branch 'main' of https://github.com/wildmeshing/wildmeshing-too…
yunfanzhou Sep 27, 2023
bfef984
Merge https://github.com/wildmeshing/wildmeshing-toolkit into hacktho…
yunfanzhou Sep 28, 2023
6220d32
modified primitives in VertexAttributesUpdateBase
yunfanzhou Sep 28, 2023
6c53106
initialize invariants for LaplacianSmooth
yunfanzhou Sep 28, 2023
edb9085
compilation fix for differentiable smooth and its child class
yunfanzhou Sep 28, 2023
d350ef5
compilation fix for test smoothing
yunfanzhou Sep 28, 2023
ae9018f
Merge branch 'main' into hackthon/yunfan/energy
yunfanzhou Oct 2, 2023
dc1c210
Merge remote-tracking branch 'origin/main' into hackthon/yunfan/energy
yunfanzhou Oct 2, 2023
abb43f6
adding a add_operation_factory to allow for direct passing of factori…
mtao Oct 3, 2023
e880309
Merge branch 'hackthon/yunfan/energy' of https://github.com/wildmeshi…
yunfanzhou Oct 3, 2023
b358ada
compiled new operation creation
yunfanzhou Oct 3, 2023
523529e
It's doing something but newton method is still not totally correct
yunfanzhou Oct 3, 2023
0953dd2
paased test for Newton Method smooth
yunfanzhou Oct 4, 2023
c4813b1
m_output needs to be resurrected
yunfanzhou Oct 5, 2023
3b1f81e
add newton with line search
yunfanzhou Oct 5, 2023
d5f31b4
cleaning print messages, add more tests
yunfanzhou Oct 5, 2023
e97fc1a
change AMIPS code style
yunfanzhou Oct 10, 2023
cc67e1e
small changes to format
yunfanzhou Oct 10, 2023
10481dd
single 2d tri with pos example. And change 2d energy test for amips u…
yunfanzhou Oct 10, 2023
67835c6
add helper function for signed 2d tri
yunfanzhou Oct 10, 2023
bba7525
transposing matrices per row major or col major
yunfanzhou Oct 11, 2023
35dee5e
small changes to test
yunfanzhou Oct 11, 2023
5fd038c
middle of a bunch of refactoring
mtao Oct 13, 2023
5ee9c8e
Merge remote-tracking branch 'base/main' into hackthon/yunfan/energy
mtao Oct 14, 2023
8447cf8
new amips structure in place, with basic 2d and 3d
mtao Oct 14, 2023
e230791
refactoring position map and cleaning up headers
mtao Oct 14, 2023
eb512fa
making function unit tests build
mtao Oct 14, 2023
1fe84cd
changing ampis functions to match positive area FV structures
mtao Oct 14, 2023
19f6a99
centralizing wmtk image deps into the main cmake
mtao Oct 14, 2023
de64bb3
adding invariant initialization in some meshes
mtao Oct 14, 2023
13aa0d7
optimization operations all build
mtao Oct 15, 2023
690171e
let scheudler return const ref to factories created
mtao Oct 15, 2023
78fed45
works? too big and too tired to proeprly comment
mtao Oct 15, 2023
d3791a6
Merge pull request #449 from mtao/mtao/energy
mtao Oct 16, 2023
21901a0
Merge branch 'hackthon/yunfan/energy' into 456-improve-semantics-of-f…
mtao Oct 16, 2023
b1c2c56
Merge branch 'hackthon/yunfan/energy' of https://github.com/wildmeshi…
yunfanzhou Oct 16, 2023
9405d33
persimplex functions draft (not compiled)
yunfanzhou Oct 16, 2023
0067ccc
get mesh in persimplexfunction
yunfanzhou Oct 16, 2023
ff8f168
find the upper level cofaces of a simplex in TriMesh. Tests passed. H…
yunfanzhou Oct 19, 2023
5ecb6b2
add public function for getting attribute primitive type in MeshAttrH…
yunfanzhou Oct 20, 2023
d591a8e
upper level cofaces using general Mesh type
yunfanzhou Oct 20, 2023
0bf9576
define persimplexfunction
yunfanzhou Oct 20, 2023
d2a6819
Differentiable extension of the persimplexfunction
yunfanzhou Oct 20, 2023
933ab8a
New function class and locally differnetiable function class using th…
yunfanzhou Oct 20, 2023
dcb51dd
cmake for differentiable function refactor
yunfanzhou Oct 20, 2023
a6122d1
comment functionevaluator in cmake out for compilation
yunfanzhou Oct 20, 2023
4780770
AutodiffFunction takes input primitive type
yunfanzhou Oct 24, 2023
8504b99
add Sipmlex Type to AMIPS constructor
yunfanzhou Oct 24, 2023
4d5fcc2
take out mesh from Function and locally differentiable function
yunfanzhou Oct 24, 2023
2e2f4d1
perSimplexFunction deconstructor
yunfanzhou Oct 24, 2023
48f9401
change member variable names add assertions to position amips 2d
yunfanzhou Oct 24, 2023
a71ba52
add per simplex valence function, change previous valence function to…
yunfanzhou Oct 24, 2023
be219db
chnage energy tests for compilation
yunfanzhou Oct 24, 2023
a930ba0
Merge branch 'main' into 456-improve-semantics-of-functions-to-clarif…
mtao Oct 25, 2023
669b591
restricting get_gradient and hessian to only the differnetiableFuncti…
yunfanzhou Oct 25, 2023
d690f0c
add simplex type in constructor for PerSImplexFunction. Check type va…
yunfanzhou Oct 25, 2023
fef47da
returning per simplex function in Function
yunfanzhou Oct 25, 2023
2d09286
change naming get_function_type and get_local_gradient
yunfanzhou Oct 25, 2023
54c1b63
Taking DifferentiableEvaluator in base smoothing
yunfanzhou Oct 25, 2023
0f7d280
compilation in smoothing gradient descent
yunfanzhou Oct 25, 2023
cbd1db0
change top level to upper level in LineSearch class
yunfanzhou Oct 25, 2023
3b3f2f4
Merge branch '456-improve-semantics-of-functions-to-clarify-what-simp…
yunfanzhou Oct 25, 2023
fb26313
warning. add upper_level_cofaces to cmake
yunfanzhou Oct 25, 2023
a06b3de
Merge pull request #457 from wildmeshing/456-improve-semantics-of-fun…
mtao Oct 26, 2023
aca64f8
Merge remote-tracking branch 'base/main' into hackthon/yunfan/energy
mtao Oct 26, 2023
7cfb406
updated basic function interface to have ocnsistent naming
mtao Oct 28, 2023
7cdcf39
renaming upper_level_cofaces to cofaces_single_dimension
mtao Oct 28, 2023
18887b5
adding comment to coface_single_dimension and removing infinite loop
mtao Oct 28, 2023
cde20d8
commiting forgotten function interafce updates
mtao Oct 28, 2023
c780fe9
adding primitive range function to conveniently get ranges of simplices
mtao Oct 29, 2023
fc20f3a
updates to functions, line search might be broken
mtao Oct 29, 2023
95d56bb
updating line search to check higher level simplices for invariants
mtao Oct 29, 2023
18089d6
removing unecessary assert
mtao Oct 29, 2023
1206ece
Merge remote-tracking branch 'base/main' into hackthon/yunfan/energy
mtao Oct 29, 2023
b193996
fixing the simplex types for some functions/tests
mtao Oct 29, 2023
e875bb8
making cofaces single dimension tests less order dependent
mtao Oct 29, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ include(metis)
include(gmp)
include(probabilistic_quadrics)

# Dependencies for images
include(stb)
include(tinyexr)


include(lagrange)
lagrange_include_modules(bvh)

Expand Down Expand Up @@ -134,7 +139,12 @@ wmtk_target_link_system_libraries(wildmeshing_toolkit PUBLIC
probabilistic_quadrics::probabilistic_quadrics
paraviewo::paraviewo
gmp::gmp
)


miniz # MTAO: I had a build issue with windows not finding miniz at linktime - adding here to make sure it's there?
tinyexr
stb::image
)

include(nlohmann_json)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ IsotropicRemeshing::IsotropicRemeshing(TriMesh& mesh, const double length, const
op_settings.smooth_settings.position = m_position_handle;
op_settings.smooth_settings.smooth_boundary = !m_lock_boundary;

op_settings.smooth_settings.initialize_invariants(m_mesh);

m_scheduler.add_operation_type<tri_mesh::VertexTangentialLaplacianSmooth>(
"smooth",
op_settings);
Expand Down
8 changes: 8 additions & 0 deletions src/wmtk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,20 @@ set(SRC_FILES
)
target_sources(wildmeshing_toolkit PRIVATE ${SRC_FILES})




add_subdirectory(io)
add_subdirectory(utils)
add_subdirectory(attribute)
add_subdirectory(simplex)
add_subdirectory(operations)
add_subdirectory(optimization)
add_subdirectory(autogen)

add_subdirectory(invariants)
add_subdirectory(multimesh)

add_subdirectory(function)
add_subdirectory(image)

1 change: 1 addition & 0 deletions src/wmtk/Scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ void Scheduler::run_operation_on_all(PrimitiveType type, const std::string& name
// enqueue_operations(ops);
// TODO: pick some strategy for running these operations
// tbb::parallel_for(ops, [&](const auto& ops) { (*op)(); });
spdlog::info("Ran {} [{}] ops, {} succeeded, {} failed", number_of_performed_operations(), name, number_of_successful_operations(), number_of_failed_operations());
}

void Scheduler::enqueue_operations(std::vector<std::unique_ptr<operations::Operation>>&& ops)
Expand Down
28 changes: 22 additions & 6 deletions src/wmtk/Scheduler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "operations/Operation.hpp"
#include "operations/OperationFactory.hpp"


namespace wmtk {

// Scheduler scheduler;
Expand All @@ -31,20 +30,37 @@ class Scheduler
// primitive_type,
// std::forward<Args>(args)...);
//}

const operations::OperationFactoryBase& add_operation_factory(
const std::string& name,
std::unique_ptr<operations::OperationFactoryBase>&& ptr)
{
return *(m_factories[name] = std::move(ptr));
}
template <typename OperationType>
void add_operation_type(const std::string& name)
const operations::OperationFactory<OperationType>& add_operation_type(
const std::string& name,
const operations::OperationSettings<OperationType>& settings)
{
m_factories[name] = std::make_unique<operations::OperationFactory<OperationType>>();
return static_cast<const operations::OperationFactory<OperationType>&>(
add_operation_factory(
name,
std::make_unique<operations::OperationFactory<OperationType>>(settings)));
}

template <typename OperationType>
void add_operation_type(
const operations::OperationFactory<OperationType>& add_operation_type(
const std::string& name,
const operations::OperationSettings<OperationType>& settings)
operations::OperationSettings<OperationType>&& settings)
{
m_factories[name] = std::make_unique<operations::OperationFactory<OperationType>>(settings);
return static_cast<const operations::OperationFactory<OperationType>&>(
add_operation_factory(
name,
std::make_unique<operations::OperationFactory<OperationType>>(
std::move(settings))));
}


void enqueue_operations(std::vector<std::unique_ptr<operations::Operation>>&& ops);


Expand Down
10 changes: 10 additions & 0 deletions src/wmtk/Types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,21 @@ namespace wmtk {
template <typename T, int C>
using RowVectors = Eigen::Matrix<T, Eigen::Dynamic, C>;

template <typename T, int R>
using SquareMatrix = Eigen::Matrix<T, R, R>;

template <typename T, int R>
using Vector = Eigen::Matrix<T, R, 1>;
template <typename T>
using VectorX = Vector<T, Eigen::Dynamic>;

template <typename T>
using Vector2 = Vector<T, 2>;
template <typename T>
using Vector3 = Vector<T, 3>;
template <typename T>
using Vector4 = Vector<T, 4>;

template <typename T, int C>
using RowVector = Eigen::Matrix<T, 1, C>;
template <typename T>
Expand Down
6 changes: 5 additions & 1 deletion src/wmtk/attribute/AttributeHandle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <type_traits>
#include "wmtk/Primitive.hpp"
namespace wmtk {
class Mesh;
class Mesh;
namespace attribute {
template <typename T>
class MeshAttributes;
Expand Down Expand Up @@ -36,6 +36,8 @@ class AttributeHandle


bool operator==(const AttributeHandle& other) const { return index == other.index; }

bool is_valid() const { return index != -1; }
};

template <typename T>
Expand Down Expand Up @@ -71,6 +73,8 @@ class MeshAttributeHandle
return std::is_same_v<T, U> && m_base_handle == o.m_base_handle &&
m_primitive_type == o.m_primitive_type;
}
bool is_valid() const { return m_base_handle.is_valid(); }
PrimitiveType primitive_type() const { return m_primitive_type; }
};
} // namespace attribute
using AttributeHandle = attribute::AttributeHandle;
Expand Down
2 changes: 2 additions & 0 deletions src/wmtk/attribute/MutableAccessor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ class MutableAccessor : public ConstAccessor<T>
using CachingBaseType::mesh;
using CachingBaseType::stack_depth;

using ConstAccessorType::mesh;

protected:
using ConstAccessorType::base_type;
using ConstAccessorType::caching_base_type;
Expand Down
106 changes: 0 additions & 106 deletions src/wmtk/energy/AMIPS.cpp

This file was deleted.

44 changes: 0 additions & 44 deletions src/wmtk/energy/AMIPS.hpp

This file was deleted.

9 changes: 0 additions & 9 deletions src/wmtk/energy/DifferentiableEnergy.hpp

This file was deleted.

9 changes: 0 additions & 9 deletions src/wmtk/energy/Energy.cpp

This file was deleted.

17 changes: 0 additions & 17 deletions src/wmtk/energy/Energy.hpp

This file was deleted.

9 changes: 9 additions & 0 deletions src/wmtk/function/AMIPS.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include "AMIPS.hpp"
#include <wmtk/TriMesh.hpp>

namespace wmtk::function {
AMIPS::AMIPS(const TriMesh& mesh, const MeshAttributeHandle<double>& vertex_attribute_handle)
: AutodiffFunction(mesh, PrimitiveType::Face, vertex_attribute_handle)
{}

} // namespace wmtk::function
10 changes: 10 additions & 0 deletions src/wmtk/function/AMIPS.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#pragma once
#include "AutodiffFunction.hpp"
namespace wmtk::function {
class AMIPS : public AutodiffFunction

Check warning on line 4 in src/wmtk/function/AMIPS.hpp

View check run for this annotation

Codecov / codecov/patch

src/wmtk/function/AMIPS.hpp#L4

Added line #L4 was not covered by tests
{
public:
AMIPS(const TriMesh& mesh, const MeshAttributeHandle<double>& vertex_attribute_handle);
};

} // namespace wmtk::function
Loading
Loading