📄 projectl2.cpp
字号:
// Copyright (C) 2008 Johan Jansson.// Licensed under the GNU LGPL Version 2.1.//// First added: 2008-03-18// Last changed: 2008-03-18//#include <dolfin/mesh/Mesh.h>#include <dolfin/elements/ProjectionLibrary.h>#include <dolfin/pde/LinearPDE.h>#include "Function.h"#include "ProjectL2.h"using namespace dolfin;//-----------------------------------------------------------------------------void dolfin::projectL2(Mesh& meshB, Function& fA, Function& fB, ufc::finite_element& element){ Form* a = ProjectionLibrary::create_projection_a(element.signature()); Form* L = ProjectionLibrary::create_projection_L(element.signature(), fA); // Compute projection // FIXME: LinearPDE should not own memory from fB, allocate on heap for now LinearPDE* pde = new LinearPDE(*a, *L, meshB); pde->solve(fB);}//-----------------------------------------------------------------------------void dolfin::projectL2NonMatching(Mesh& meshB, Function& fA, Function& fB, ufc::finite_element& element){ // Create non-matching function fN NonMatchingFunction fN(meshB, fA); Form* a = ProjectionLibrary::create_projection_a(element.signature()); Form* L = ProjectionLibrary::create_projection_L(element.signature(), fN); // Compute projection // FIXME: LinearPDE should not own memory from fB, allocate on heap for now LinearPDE* pde = new LinearPDE(*a, *L, meshB); pde->solve(fB);}//-----------------------------------------------------------------------------NonMatchingFunction::NonMatchingFunction(Mesh& mesh, Function& fA) : Function(mesh), fA(fA){}//-----------------------------------------------------------------------------void NonMatchingFunction::eval(real* values, const real* x) const{ // Evaluate discrete function fA pointwise fA.eval(values, x);}//-----------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -