📄 opt.h
字号:
/*==============================================================================
O F E L I
Object Finite Element Library
==============================================================================
Copyright (C) 1998 - 2004 Rachid Touzani
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; Version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the :
Free Software Foundation
Inc., 59 Temple Place - Suite 330
Boston, MA 02111-1307, USA
==============================================================================*/
#ifndef __OPT_H
#define __OPT_H
#include "OFELI.h"
#include "Therm.h"
#include "User.h"
using namespace OFELI;
class Opt {
public:
Opt(Mesh &ms, User &ud) { ms_ = &ms; ud_ = &ud; }
void Objective(Vect<real_t> &x, real_t &f, Vect<real_t> &g) {
Element *el;
f = 0.;
g = 0.;
for (ms_->TopElement(); (el=ms_->GetElement());) {
DC2DT3 eq(el);
Vect<real_t> ge(3);
Vect<real_t> xe(el,x);
f += eq.Energy(xe,*ud_);
eq.EnerGrad(xe,*ud_,ge);
g.Assembly(el,ge);
}
}
private:
Mesh *ms_;
User *ud_;
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -