Skip to content

Commit 18cdb53

Browse files
Nightly Botcwsmith
authored andcommitted
Merging develop into master
2 parents b31683d + 65b33bb commit 18cdb53

19 files changed

+2274
-25
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ add_subdirectory(pumi)
136136
add_subdirectory(ma)
137137
add_subdirectory(crv)
138138
add_subdirectory(spr)
139+
add_subdirectory(ree)
139140
add_subdirectory(sam)
140141
add_subdirectory(phasta)
141142
add_subdirectory(stk)

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ For more information, start at our
2626
* MTH: Math containers and routines
2727
* CRV: Support for curved meshes with Bezier Shapes
2828
* PYCORE: Python Wrappers (see python_wrappers/README.md for build instructions)
29+
* REE: Residual based implicit error estimator
2930

3031
### How do I get set up? ###
3132

apf/apf.cc

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
* This work is open source software, licensed under the terms of the
55
* BSD license as described in the LICENSE file in the top-level directory.
66
*/
7-
87
#include "apf.h"
98
#include "apfScalarField.h"
109
#include "apfScalarElement.h"
@@ -464,28 +463,20 @@ void getVectorShapeValues(Element* e, Vector3 const& local,
464463
NewArray<Vector3> vvals(values.size());
465464
e->getShape()->getVectorValues(e->getMesh(), e->getEntity(), local, vvals);
466465

467-
// Perform Piola transformation
468-
if( e->getDimension() == e->getMesh()->getDimension() ) // i.e. J is square
469-
{
470-
apf::Matrix3x3 Jinv;
471-
apf::getJacobianInv( e->getParent(), local, Jinv );
472-
apf::Matrix3x3 JinvT = apf::transpose(Jinv);
473-
474-
// u(x_hat) * J(x_hat)^{-1}
475-
for( size_t i = 0; i < values.size(); i++ ) {
476-
for ( int j = 0; j < 3; j++ ) {
477-
values[i][j] = 0.;
478-
for ( int k = 0; k < 3; k++ )
479-
values[i][j] += vvals[i][k] * JinvT[k][j];
480-
}
466+
apf::Matrix3x3 Jinv;
467+
apf::getJacobianInv( e->getParent(), local, Jinv );
468+
apf::Matrix3x3 JinvT = apf::transpose(Jinv);
469+
470+
// Perform Piola transformation - u(x_hat) * J(x_hat)^{-1}
471+
int d = 0;
472+
(e->getDimension() == e->getMesh()->getDimension()) ? d = 3 : d = 2;
473+
for( size_t i = 0; i < values.size(); i++ ) {
474+
for ( int j = 0; j < 3; j++ ) {
475+
values[i][j] = 0.;
476+
for ( int k = 0; k < d; k++ )
477+
values[i][j] += vvals[i][k] * JinvT[k][j];
481478
}
482479
}
483-
else
484-
{
485-
// TODO when ref dim != mesh space dim. Pseudo-inverse needed.
486-
PCU_ALWAYS_ASSERT_VERBOSE(false,
487-
"not yet implemented for 3D surface meshes (i.e., manifolds)!");
488-
}
489480
}
490481

491482
void getCurlShapeValues(Element* e, Vector3 const& local,

apf/apfElement.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,4 +119,11 @@ void Element::getNodeData()
119119
field->getData()->getElementData(entity,nodeData);
120120
}
121121

122+
void Element::getElementNodeData(NewArray<double>& d)
123+
{
124+
d.allocated() ? d.resize(nen) : d.allocate(nen);
125+
for (int i = 0; i < nen; i++)
126+
d[i] = nodeData[i];
127+
}
128+
122129
}//namespace apf

apf/apfElement.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class Element
3535
EntityShape* getShape() {return shape;}
3636
FieldShape* getFieldShape() {return field->getShape();}
3737
void getComponents(Vector3 const& xi, double* c);
38+
void getElementNodeData(NewArray<double>& d);
3839
protected:
3940
void init(Field* f, MeshEntity* e, VectorElement* p);
4041
void getNodeData();

mth/mth_def.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@ template <class T, unsigned M, unsigned N>
5757
void transpose(Matrix<T,M,N> const& a,
5858
Matrix<T,N,M>& b)
5959
{
60-
unsigned m = a.rows();
60+
unsigned m = a.cols();
6161
unsigned n = a.rows();
6262
b.resize(m, n);
6363
for (unsigned i=0; i < m; ++i)
64-
for (unsigned j=0; j < n; ++j)
65-
b(j,i) = a(i,j);
64+
for (unsigned j=0; j < n; ++j)
65+
b(i,j) = a(j,i);
6666
}
6767

6868
template <class T>

ree/CMakeLists.txt

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
if(DEFINED TRIBITS_PACKAGE)
2+
include(pkg_tribits.cmake)
3+
return()
4+
endif()
5+
6+
# Package sources
7+
set(SOURCES
8+
reeResidualFunctionals.cc
9+
reeFluxCorrection.cc
10+
reeCorrectedFlux.cc
11+
reeEstimateError.cc
12+
reeSizeField.cc)
13+
14+
# Package headers
15+
set(HEADERS
16+
ree.h)
17+
18+
# Add the ree library
19+
add_library(ree ${SOURCES})
20+
21+
# Include directories
22+
target_include_directories(ree INTERFACE
23+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
24+
$<INSTALL_INTERFACE:include>
25+
)
26+
27+
# Link this package to these libraries
28+
target_link_libraries(ree PUBLIC apf pcu)
29+
30+
scorec_export_library(ree)
31+
32+
bob_end_subdir()

ree/cmake/Dependencies.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
TRIBITS_PACKAGE_DEFINE_DEPENDENCIES(
2+
LIB_REQUIRED_PACKAGES SCORECapf
3+
)

ree/pkg_tribits.cmake

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
tribits_package(SCORECree)
2+
3+
# THIS IS WHERE TRIBITS GETS HEADERS
4+
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
5+
6+
#Sources & Headers
7+
set(SOURCES
8+
reeResidualFunctionals.cc
9+
reeFluxCorrection.cc
10+
reeCorrectedFlux.cc
11+
reeEstimateError.cc
12+
reeSizeField.cc)
13+
14+
set(HEADERS
15+
ree.h)
16+
17+
#Library
18+
tribits_add_library(
19+
ree
20+
HEADERS ${HEADERS}
21+
SOURCES ${SOURCES})
22+
23+
tribits_package_postprocess()

0 commit comments

Comments
 (0)