Comments (5)
With commit 0a9acd5, a first version of the new design of CellValues and Fields is available (for the moment only in branch refactoring_cell_values, where the code downstream from this part is still commented).
Features of the new design:
-
Introduction of
NumberKernel
andArrayKernel
. Two types that represent operations that return numbers and arrays respectively. These operations are allowed to have arbitrary number of arguments. E.g.CellsumKernel
takes an array and returns another array resulting from summing up all the entries in one dimension. Other available kernels are e.g.,VarinnerKarnel
,LinCombKernel
. -
Introduction of the function
apply
. It takes aNumberKernel
or anArrayKernel
and an arbitrary number ofCellValues
. It lazily applies the given kernel to the givenCellValues
. E.g., applying theVarinnerKernel
to aCellBasis
and aCellField
will return aCellMap
object representing an (unevaluated) element vector. In the arguments of theapply
function, we can mix e.g.,CellMaps
andCellArray
in an (almost) arbitrary way. E.g., we can apply theLinCombKernel
to aCellBasis
and aCellVector
, which will result in aCellField
. Applying theLinCombKernel
to aCellMatrix
and aCellVector
will return aCellVector
. The functionapply
has several overloaded methods for optimization. E.g., applying a kernel to a set ofConstantCellValues
will return also aConstantCellValue
. Applying it to a set ofIndexCellValues
will return anIndexCellValue
. -
Expressivity, extensibility and performance. By defining its own kernels and using the
apply
function, the user will rarely need to implementCellValue
types (which is quite tedious) for their particular needs. The kernels also allow to fuse very complex operations in a singleCellValue
object instead of having a very complex operation trees betweenCellValue
objects, which will definitively improve performance and compilation times. -
. I was not able to achieve this in all cases. E.g., forFields
,Basis
,CellFields
, andCellBasis
return always the same object when calling thegradient
function. Before, each time thegradient
function was called, a new object was created. Now the same object is always returned. This is a first step in order to optimize loops by do not recomputing values associated to quantities that appear in several terms. The next step will by to cache the values returned at each cell (to be done)ConstantCellValues
. So, we cannot assume that the gradient function will return always the same object. In any case, I think this is not strictly needed always. Only for theFEBasis
,FEFunction
andCellFields
obtained from an analytical function we really need this behavior. -
New design is based on the
TensorValues
package. This allows to defineconst FieldValue = Number
, and to simplify a lot broadcasting. -
New code structure based on reexport. I am following a new code structure, where each file defines a module. I have learned (the hard way) that this is a must in a large project. In particular, if we want that the files can be moved easily without worrying a lot about the
using
andimport
statements. I am also using reexport. The objective is that (with few exceptions) modules only export names that are going to be used in the top level name-space of theGridap
project. This also allows to simply writeusing Gridap
withinGridap
itself to get access to the names that have already been defined and exported. E.g., in the files related with fe spaces, it will be only necessary to writeusing Gridap
to get access to e.g.,CellField
.
from gridap.jl.
Things to be done:
-
apply
function can take up to 6 arguments for the moment. This can be easily generalized by using generated functions. This is still to be fixed. Moved to a separate issue (see issue #32) - An internal julia error es appearing very often. I have included a set of hacks to circumvent this error, but this has to be fixed better. I think it is related with the fact that I am storing tuples of objects in the fields of structs... I have obtained some help from the Julia developers (JuliaLang/julia#32322) about this. The issue is fixed in julia master, and they suggested me a workaround to avoid it in the 1.1 version.
- The rest of the code has still to be adapted to the new design
from gridap.jl.
I have opened an issue in julia about the internal error (JuliaLang/julia#32322)
from gridap.jl.
The refactoring is already available in master since PR #31.
Closing issue
from gridap.jl.
Note for developers (specialy for @santiagobadia ):
PR #31 has introduced backward incompatible changes into master.
This is an illustrative (but strictly speaking incomplete) list of the changes to be aware of:
-
VectorValue{D,T}
,TensorValue{D,T,L}
, andPoint{D,T}
are now parametrized also byT
the type of the stored entries. BeforeT
was alwaysFloat64
. So, if, e.g., we want to initialize an array of points we need also to specifyT
:zeros(Point{3,Int},10,3)
-
The
celldata
function used to get the unique value in aConstantCellValue
is removed. Use the fieldvalue
instead. -
To get access to the cell value wrappers (e.g.,
CellValueFromArray
) one has to writeusing Gridap.CellValuesGallery
-
celltypes
andcellorders
functions have been removed from theTriangulation
interface (now, they are only in theGrid
interface). Instead, we have definedCellRefFEs(::Triangulation)
that returns aCellValue{<:RefFE}
(usually aConstantCellValue
) indicating the reference elements in the cells of the triangulation. -
Renamed
cellcoordinates(::Triangulation)
->CellPoints(::Triangulation)
-
Renamed
cellbasis(::Triangulation)
->CellBasis(::Triangulation)
-
Renamed
geomap(::Triangulation)
->CellGeomap(::Triangulation)
from gridap.jl.
Related Issues (20)
- Nedelec element on boundaries HOT 6
- Unexpected behaviour, if evaluating function on grid HOT 2
- Difficulty with complex vector-valued interior facet weak forms HOT 2
- Improve memory efficiency of Modal C0 Bases
- Error when evaluating fine-grid DoFs on coarse FEFunction or FEBasis HOT 2
- Implementation of MultiFieldStyle in TransientMultiFieldFESpaces HOT 5
- MultiFlield Boundary Condition Problem HOT 3
- Runge Kutta methods for linear operators only HOT 4
- Normal displacement boundary condition in linear elasticity problems HOT 3
- To-think: a less restrictive type for the type of the operator in `LinearSolver` abstract interface?
- Eigen-values and vectors of SymTensorValue HOT 3
- Refactoring of the ODE module
- Solving non-linear coupled PDEs HOT 2
- Gridap and solvers from DifferentialEquations.jl HOT 7
- Neumann boundary conditions and different geometries HOT 3
- Computing gradient wrt Dirichlet data
- confusion about vectors sizes HOT 4
- `MultiFieldFESpace` with complex numbers HOT 2
- Error with the function `_point_to_cell ` when using a triangular mesh
- Wrong result when multiplying integrand with scalar when using `InterfaceTriangulation`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gridap.jl.