27 #include "../Rocblas/include/Rocblas.h"
31 static inline double sign(
double x) {
32 return (x>=0) ? 1 : -1;
40 ws[0] = ws[1] = ws[2] = 0.;
46 for (
int i=0;
i<size;
i++){
51 const Real &xi=nc[0], &eta=nc[1];
63 const Real su = weight * ((1-eta)*uv-(1-xi)*(u*u))/jacobi_det;
64 const Real sv = weight * ((1-xi)*uv-(1-eta)*(v*
v))/jacobi_det;
66 ws[0] += (1-eta)*sv -xi*su;
67 ws[1] += xi*su + eta*sv;
68 ws[2] += (1-xi)*su - eta*sv;;
69 area += weight * jacobi_det;
80 compute_mcn( COM::Attribute *mcn_in, COM::Attribute *lbmcn_in) {
82 COM_assertion( mcn_in != NULL && mcn_in ->size_of_components() == 3 &&
84 COM_assertion( lbmcn_in != NULL && lbmcn_in->size_of_components() == 3 &&
85 lbmcn_in->is_nodal());
87 COM::Attribute *mcn, *lbmcn;
91 false,
true, NULL, 0);
96 lbmcn =
_buf_window->inherit( lbmcn_in,
"lbmcn__MCNTEMP",
97 false,
true, NULL, 0);
102 COM::Attribute *areas=NULL, *weights=NULL;
103 areas =
_buf_window->new_attribute(
"areas__MCNTEMP",
'n',
107 weights =
_buf_window->new_attribute(
"weights__MCNTEMP",
'e',
118 std::vector< COM::Pane*> panes;
119 mcn->window()->panes( panes);
122 std::vector< COM::Pane*>::const_iterator it = panes.begin();
126 for (
int i=0, local_npanes = panes.size();
i<local_npanes; ++
i, ++it){
127 const COM::Pane &pane = **it;
132 (pane.attribute( mcn->id())->pointer());
134 (pane.attribute( weights->id())->pointer());
135 Real *area_ptr = (
Real *)(pane.attribute( areas->id())->pointer());
140 for (
int j=0, jsize=pane.size_of_elements();
j<jsize; ++
j, ene.
next()) {
143 for (
int kk=0; kk<ne; ++kk)
148 for (
int k=0;
k<ne; ++
k) {
150 ps[0] = pnts[ene[
k]-1];
151 ps[1] = ps[0]+0.5*(pnts[ene[(
k+1)%ne]-1]-ps[0]);
153 ps[3] = ps[0]+0.5*(pnts[ene[(
k+ne-1)%ne]-1]-ps[0]);
161 ws[2]*(ps[3]-ps[0]));
163 mcn_ptr[ ene[
k]-1] += dA;
177 for (
int i=0, local_npanes = panes.size();
i<local_npanes; ++
i, ++it) {
178 const COM::Pane &pane = **it;
181 (pane.attribute( mcn->id())->pointer());
183 (pane.attribute( weights->id())->pointer());
186 (pane.attribute( lbmcn->id())->pointer());
192 for (
int j=0, jsize=pane.size_of_elements();
j<jsize; ++
j, ene.
next()) {
196 for (
int k=0;
k<ne; ++
k) {
200 fs[0] = mcn_ptr[ii0].
norm();
205 for (
int kk=1; kk<ne; ++kk) {
206 int ii=ene[(
k+kk)%ne]-1;
208 fs[kk] =
sign(mcn_ptr[ii]*vec)*mcn_ptr[ii].
norm();
212 lbmcn_ptr[ ene[
k]-1] += 4.*(ws[0]*(fs[1]-fs[0])+ws[1]*(fs[2]-fs[0])+
213 ws[2]*(fs[3]-fs[0]))*vec;
#define COM_assertion(EX)
Error checking utility similar to the assert macro of the C language.
static SURF_BEGIN_NAMESPACE double sign(double x)
An adaptor for enumerating node IDs of an element.
COM::Window * _buf_window
static double compute_lbop_weights(Point_3< Real > *ps, Real *ws)
#define SURF_END_NAMESPACE
void get_gp_nat_coor(const Size i, Nat_coor &nc, const Size doa=0) const
Get the natrual coordinate associated with a Gauss point.
Encapsulation of the element-wise computations for two-dimensional elements.
Real get_gp_weight(const Size i, const Size doa=0) const
Get the weight associated with a Gauss point.
*********************************************************************Illinois Open Source License ****University of Illinois NCSA **Open Source License University of Illinois All rights reserved ****Developed free of to any person **obtaining a copy of this software and associated documentation to deal with the Software without including without limitation the rights to and or **sell copies of the and to permit persons to whom the **Software is furnished to do subject to the following this list of conditions and the following disclaimers ****Redistributions in binary form must reproduce the above **copyright this list of conditions and the following **disclaimers in the documentation and or other materials **provided with the distribution ****Neither the names of the Center for Simulation of Advanced the University of nor the names of its **contributors may be used to endorse or promote products derived **from this Software without specific prior written permission ****THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE v
#define SURF_BEGIN_NAMESPACE
void reduce_on_shared_nodes(COM::Attribute *attr, MPI_Op op)
Perform reduction over a given nodal attributes.
int size_of_edges() const
Number of edges per element.
static void div(const Attribute *x, const Attribute *y, Attribute *z)
Operation wrapper for division.
static Vector_3 cross_product(const Vector_3 &v, const Vector_3 &w)
static void copy_scalar(const void *x, Attribute *y)
Operation wrapper for copy (x is a scalar pointer).
void compute_mcn(COM::Attribute *mcn_in, COM::Attribute *lbmcn_in)
Size get_num_gp(const Size doa=0) const
Get the number of Gauss points.
void next()
Go to the next element within the connectivity tables of a pane.
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_GROUP_EMPTY INTEGER MPI_SUM