-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit bdf33d0
Showing
21 changed files
with
2,616 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.libs | ||
*-opt | ||
*-dbg | ||
*.so | ||
*.so.* | ||
*.la | ||
*.lo | ||
# Editor junk | ||
*.swp | ||
*.lo.d |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
############################################################################### | ||
################### MOOSE Application Standard Makefile ####################### | ||
############################################################################### | ||
# | ||
# Optional Environment variables | ||
# MOOSE_DIR - Root directory of the MOOSE project | ||
# | ||
############################################################################### | ||
# Use the MOOSE submodule if it exists and MOOSE_DIR is not set | ||
MOOSE_SUBMODULE := $(CURDIR)/moose | ||
ifneq ($(wildcard $(MOOSE_SUBMODULE)/framework/Makefile),) | ||
MOOSE_DIR ?= $(MOOSE_SUBMODULE) | ||
else | ||
MOOSE_DIR ?= $(shell dirname `pwd`)/moose | ||
endif | ||
|
||
# framework | ||
FRAMEWORK_DIR := $(MOOSE_DIR)/framework | ||
include $(FRAMEWORK_DIR)/build.mk | ||
include $(FRAMEWORK_DIR)/moose.mk | ||
|
||
################################## MODULES #################################### | ||
# To use certain physics included with MOOSE, set variables below to | ||
# yes as needed. Or set ALL_MODULES to yes to turn on everything (overrides | ||
# other set variables). | ||
|
||
ALL_MODULES := no | ||
|
||
CHEMICAL_REACTIONS := no | ||
CONTACT := yes | ||
FLUID_PROPERTIES := no | ||
HEAT_CONDUCTION := yes | ||
MISC := no | ||
NAVIER_STOKES := no | ||
PHASE_FIELD := no | ||
RDG := no | ||
RICHARDS := no | ||
SOLID_MECHANICS := no | ||
STOCHASTIC_TOOLS := no | ||
TENSOR_MECHANICS := yes | ||
WATER_STEAM_EOS := no | ||
XFEM := no | ||
POROUS_FLOW := no | ||
|
||
include $(MOOSE_DIR)/modules/modules.mk | ||
############################################################################### | ||
|
||
# dep apps | ||
APPLICATION_DIR := $(CURDIR) | ||
APPLICATION_NAME := deer | ||
BUILD_EXEC := yes | ||
DEP_APPS := $(shell $(FRAMEWORK_DIR)/scripts/find_dep_apps.py $(APPLICATION_NAME)) | ||
include $(FRAMEWORK_DIR)/app.mk | ||
|
||
############################################################################### | ||
# Additional special case targets should be added here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Deer | ||
===== | ||
|
||
"Fork Deer" to create a new MOOSE-based application. | ||
|
||
For more information see: [http://mooseframework.org/create-an-app/](http://mooseframework.org/create-an-app/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#ifndef DEERAPP_H | ||
#define DEERAPP_H | ||
|
||
#include "MooseApp.h" | ||
|
||
class DeerApp; | ||
|
||
template<> | ||
InputParameters validParams<DeerApp>(); | ||
|
||
class DeerApp : public MooseApp | ||
{ | ||
public: | ||
DeerApp(InputParameters parameters); | ||
virtual ~DeerApp(); | ||
|
||
static void registerApps(); | ||
static void registerObjects(Factory & factory); | ||
static void associateSyntax(Syntax & syntax, ActionFactory & action_factory); | ||
}; | ||
|
||
#endif /* DEERAPP_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* THIS FILE IS AUTOGENERATED - DO NOT EDIT */ | ||
|
||
#ifndef DEER_REVISION_H | ||
#define DEER_REVISION_H | ||
|
||
#define DEER_REVISION "unknown" | ||
|
||
#endif // DEER_REVISION_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#ifndef TIME2DINTERP_H | ||
#define TIME2DINTERP_H | ||
|
||
#include "Function.h" | ||
|
||
#include "nanoflann.hpp" | ||
#include "KDTreeVectorOfVectorsAdaptor.h" | ||
|
||
using namespace nanoflann; | ||
|
||
typedef KDTreeVectorOfVectorsAdaptor<std::vector<std::vector<Real>>, Real> kd_tree_t; | ||
|
||
class TimeNDInterp; | ||
|
||
template <> | ||
InputParameters validParams<TimeNDInterp>(); | ||
|
||
class TimeNDInterp : public Function | ||
{ | ||
public: | ||
TimeNDInterp(const InputParameters & parameters); | ||
|
||
virtual Real value(Real t, const Point & p) override; | ||
|
||
private: | ||
/// Read in data from HDF5 file | ||
void read_data(); | ||
/// Setup the KD Tree | ||
void setup_kdtree(); | ||
|
||
protected: | ||
size_t ntime_, npoints_, ndim_; | ||
FileName fname_; | ||
std::vector<std::vector<Real>> points_; | ||
std::vector<Real> times_; | ||
std::vector<std::vector<Real>> values_; | ||
std::unique_ptr<kd_tree_t> kd_; | ||
}; | ||
|
||
|
||
#endif // TIME2DINTERP_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
/*********************************************************************** | ||
* Software License Agreement (BSD License) | ||
* | ||
* Copyright 2011-16 Jose Luis Blanco (joseluisblancoc@gmail.com). | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in the | ||
* documentation and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | ||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*************************************************************************/ | ||
|
||
#pragma once | ||
|
||
#include <nanoflann.hpp> | ||
|
||
#include <vector> | ||
|
||
// ===== This example shows how to use nanoflann with these types of containers: ======= | ||
//typedef std::vector<std::vector<double> > my_vector_of_vectors_t; | ||
//typedef std::vector<Eigen::VectorXd> my_vector_of_vectors_t; // This requires #include <Eigen/Dense> | ||
// ===================================================================================== | ||
|
||
|
||
/** A simple vector-of-vectors adaptor for nanoflann, without duplicating the storage. | ||
* The i'th vector represents a point in the state space. | ||
* | ||
* \tparam DIM If set to >0, it specifies a compile-time fixed dimensionality for the points in the data set, allowing more compiler optimizations. | ||
* \tparam num_t The type of the point coordinates (typically, double or float). | ||
* \tparam Distance The distance metric to use: nanoflann::metric_L1, nanoflann::metric_L2, nanoflann::metric_L2_Simple, etc. | ||
* \tparam IndexType The type for indices in the KD-tree index (typically, size_t of int) | ||
*/ | ||
template <class VectorOfVectorsType, typename num_t = double, int DIM = -1, class Distance = nanoflann::metric_L2, typename IndexType = size_t> | ||
struct KDTreeVectorOfVectorsAdaptor | ||
{ | ||
typedef KDTreeVectorOfVectorsAdaptor<VectorOfVectorsType,num_t,DIM,Distance> self_t; | ||
typedef typename Distance::template traits<num_t,self_t>::distance_t metric_t; | ||
typedef nanoflann::KDTreeSingleIndexAdaptor< metric_t,self_t,DIM,IndexType> index_t; | ||
|
||
index_t* index; //! The kd-tree index for the user to call its methods as usual with any other FLANN index. | ||
|
||
/// Constructor: takes a const ref to the vector of vectors object with the data points | ||
KDTreeVectorOfVectorsAdaptor(const int dimensionality, const VectorOfVectorsType &mat, const int leaf_max_size = 10) : m_data(mat) | ||
{ | ||
assert(mat.size()!=0 && mat[0].size()!=0); | ||
const size_t dims = mat[0].size(); | ||
if (DIM>0 && static_cast<int>(dims)!=DIM) | ||
throw std::runtime_error("Data set dimensionality does not match the 'DIM' template argument"); | ||
index = new index_t( dims, *this /* adaptor */, nanoflann::KDTreeSingleIndexAdaptorParams(leaf_max_size ) ); | ||
index->buildIndex(); | ||
} | ||
|
||
~KDTreeVectorOfVectorsAdaptor() { | ||
delete index; | ||
} | ||
|
||
const VectorOfVectorsType &m_data; | ||
|
||
/** Query for the \a num_closest closest points to a given point (entered as query_point[0:dim-1]). | ||
* Note that this is a short-cut method for index->findNeighbors(). | ||
* The user can also call index->... methods as desired. | ||
* \note nChecks_IGNORED is ignored but kept for compatibility with the original FLANN interface. | ||
*/ | ||
inline void query(const num_t *query_point, const size_t num_closest, IndexType *out_indices, num_t *out_distances_sq, const int nChecks_IGNORED = 10) const | ||
{ | ||
nanoflann::KNNResultSet<num_t,IndexType> resultSet(num_closest); | ||
resultSet.init(out_indices, out_distances_sq); | ||
index->findNeighbors(resultSet, query_point, nanoflann::SearchParams()); | ||
} | ||
|
||
/** @name Interface expected by KDTreeSingleIndexAdaptor | ||
* @{ */ | ||
|
||
const self_t & derived() const { | ||
return *this; | ||
} | ||
self_t & derived() { | ||
return *this; | ||
} | ||
|
||
// Must return the number of data points | ||
inline size_t kdtree_get_point_count() const { | ||
return m_data.size(); | ||
} | ||
|
||
// Returns the distance between the vector "p1[0:size-1]" and the data point with index "idx_p2" stored in the class: | ||
inline num_t kdtree_distance(const num_t *p1, const size_t idx_p2,size_t size) const | ||
{ | ||
num_t s=0; | ||
for (size_t i=0; i<size; i++) { | ||
const num_t d= p1[i]-m_data[idx_p2][i]; | ||
s+=d*d; | ||
} | ||
return s; | ||
} | ||
|
||
// Returns the dim'th component of the idx'th point in the class: | ||
inline num_t kdtree_get_pt(const size_t idx, int dim) const { | ||
return m_data[idx][dim]; | ||
} | ||
|
||
// Optional bounding-box computation: return false to default to a standard bbox computation loop. | ||
// Return true if the BBOX was already computed by the class and returned in "bb" so it can be avoided to redo it again. | ||
// Look at bb.size() to find out the expected dimensionality (e.g. 2 or 3 for point clouds) | ||
template <class BBOX> | ||
bool kdtree_get_bbox(BBOX & /*bb*/) const { | ||
return false; | ||
} | ||
|
||
/** @} */ | ||
|
||
}; // end of KDTreeVectorOfVectorsAdaptor | ||
|
||
|
Oops, something went wrong.