⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 element_formulation.cpp

📁 vs.lib is a math library in C++ with a set of linear algebra and integrable / differentiable objects
💻 CPP
字号:
#include "vs_h.h"
#include "dynamic_array.h"
#include "omega_h.h"
#include "u_h.h"
#include "element_formulation.h"

static Global_Discretization default_gd(Global_Discretization());
Element_Formulation::Element_Formulation(Element_Type_Register)
    : the_global_discretization(default_gd) {
   	next = type_list; type_list = this;
}

Element_Formulation::Element_Formulation() : 
	the_global_discretization(default_gd) { 
	rep_ptr = 0; reference_count = 0; 
}
Element_Formulation::Element_Formulation(int en, Global_Discretization& gd)   : element_no(en), the_global_discretization(gd) {   Omega_eh& element = gd.omega_h()(en);   nen = element.element_node_no(),   nsd = gd.omega_h()[ element[0] ].no_of_dim();   ndf = gd.u_h()[element[0]].no_of_dim();   material_type_no = element.material_type_no();   xl &= gd.element_coordinate(en);   gl &= gd.element_fixed_variable(en);   ul &= gd.element_free_variable(en);   reference_count = 1;   rep_ptr = 0;}
static Element_Formulation __element_formulation_ret_val[100];Element_Formulation& Element_Formulation::create(int en, Global_Discretization& gd) { // a symbolic Element_Formulation object	static int count = 99;	if(++count > 99) count = 0;
	// semi-space sweeping
	if(count == 25) {
		for(int i = 50; i < 100; i++) {
			delete ::__element_formulation_ret_val[i].rep_ptr;
         ::__element_formulation_ret_val[i].rep_ptr = 0;
		}
	}
	else if(count == 75) {
		for(int i = 0; i < 50; i++) {
			delete (::__element_formulation_ret_val[i].rep_ptr);
			::__element_formulation_ret_val[i].rep_ptr = 0;
		}
	}   ::__element_formulation_ret_val[count].rep_ptr = make(en, gd); // attach a concrete Element_Formulation object	return ::__element_formulation_ret_val[count];}
Element_Formulation::~Element_Formulation() {	if(rep_ptr)   	if(--(rep_ptr->count()) < 1)   		delete rep_ptr;}
Element_Formulation::Element_Formulation(const Element_Formulation& a)	: the_global_discretization(a.the_global_discretization),	  element_no(a.element_no), nen(a.nen), nsd(a.nsd), ndf(a.ndf) {   if(a.rep_ptr) {   	rep_ptr = a.rep_ptr;   	rep_ptr->count()++;   }}
Element_Formulation& Element_Formulation::operator=(const Element_Formulation& a) {	if(this != &a) {   	the_global_discretization = a.the_global_discretization;   	element_no = a.element_no;      nen = a.nen;      nsd = a.nsd;      ndf = a.ndf;      if(a.rep_ptr) {      	if(rep_ptr) delete rep_ptr;      	rep_ptr = a.rep_ptr;         rep_ptr->count()++;      }   }   return *this;}
// protected virtual member functionC0& Element_Formulation::__lhs() {	the_lhs &= stiff;   return the_lhs;}C0& Element_Formulation::__reaction() {	the_reaction &= -stiff * gl;   return the_reaction;}C0& Element_Formulation::__rhs() {
	the_rhs &= __reaction();
	if(force.rep_ptr()) the_rhs += force;
   return the_rhs;
}

C0& Element_Formulation::__element_nodal_value() {
	return the_element_nodal_value;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -