void OGProjection<Scalar>::project_global(Hermes::vector<Space<Scalar>*> spaces, Hermes::vector<MatrixFormVol<Scalar> *> mfvol, Hermes::vector<VectorFormVol<Scalar> *> vfvol, Hermes::vector<MeshFunction<Scalar>*> source_meshfns, Scalar* target_vec, Hermes::MatrixSolverType matrix_solver_type) { _F_; unsigned int n = spaces.size(); unsigned int n_biforms = mfvol.size(); if (n_biforms == 0) error("Please use the simpler version of project_global with the argument Hermes::vector<ProjNormType> proj_norms if you do not provide your own projection norm."); if (n_biforms != vfvol.size()) error("Mismatched numbers of projection forms in project_global()."); if (n != n_biforms) error("Mismatched numbers of projected functions and projection forms in project_global()."); // This is needed since spaces may have their DOFs enumerated only locally // when they come here. int ndof = Space<Scalar>::assign_dofs(spaces); // Define projection weak form. WeakForm<Scalar>* proj_wf = new WeakForm<Scalar>(n); for (unsigned int i = 0; i < n; i++) { proj_wf->add_matrix_form(mfvol[i]); // FIXME // proj_wf->add_vector_form(i, proj_liforms[i].first, proj_liforms[i].second, HERMES_ANY, source_meshfns[i]); } project_internal(spaces, proj_wf, target_vec, matrix_solver_type); }
void OGProjection::project_global(Hermes::Tuple<Space *> spaces, Hermes::Tuple< std::pair<WeakForm::matrix_form_val_t, WeakForm::matrix_form_ord_t> > proj_biforms, Hermes::Tuple< std::pair<WeakForm::vector_form_val_t, WeakForm::vector_form_ord_t> > proj_liforms, Hermes::Tuple<MeshFunction*> source_meshfns, scalar* target_vec, MatrixSolverType matrix_solver) { _F_ unsigned int n = spaces.size(); unsigned int n_biforms = proj_biforms.size(); if (n_biforms == 0) error("Please use the simpler version of project_global with the argument Hermes::Tuple<ProjNormType> proj_norms if you do not provide your own projection norm."); if (n_biforms != proj_liforms.size()) error("Mismatched numbers of projection forms in project_global()."); if (n != n_biforms) error("Mismatched numbers of projected functions and projection forms in project_global()."); // This is needed since spaces may have their DOFs enumerated only locally // when they come here. int ndof = Space::assign_dofs(spaces); // Define projection weak form. WeakForm* proj_wf = new WeakForm(n); for (unsigned int i = 0; i < n; i++) { proj_wf->add_matrix_form(i, i, proj_biforms[i].first, proj_biforms[i].second); proj_wf->add_vector_form(i, proj_liforms[i].first, proj_liforms[i].second, HERMES_ANY, source_meshfns[i]); } project_internal(spaces, proj_wf, target_vec, matrix_solver); }
void OGProjection<Scalar>::project_global(SpaceSharedPtr<Scalar> space, MatrixFormVol<Scalar>* custom_projection_jacobian, VectorFormVol<Scalar>* custom_projection_residual, Scalar* target_vec) { // Define projection weak form. WeakForm<Scalar>* proj_wf = new WeakForm<Scalar>(1); proj_wf->add_matrix_form(custom_projection_jacobian); proj_wf->add_vector_form(custom_projection_residual); // Call the main function. project_internal(space, proj_wf, target_vec); // Clean up. delete proj_wf; }
void OGProjection<Scalar>::project_global(Hermes::vector<Space<Scalar>*> spaces, Hermes::vector<MeshFunction<Scalar>*> source_meshfns, Scalar* target_vec, Hermes::MatrixSolverType matrix_solver_type, Hermes::vector<ProjNormType> proj_norms) { _F_; int n = spaces.size(); // define temporary projection weak form WeakForm<Scalar>* proj_wf = new WeakForm<Scalar>(n); int found[100]; for (int i = 0; i < 100; i++) found[i] = 0; for (int i = 0; i < n; i++) { ProjNormType norm = HERMES_UNSET_NORM; if (proj_norms == Hermes::vector<ProjNormType>()) { SpaceType space_type = spaces[i]->get_type(); switch (space_type) { case HERMES_H1_SPACE: norm = HERMES_H1_NORM; break; case HERMES_HCURL_SPACE: norm = HERMES_HCURL_NORM; break; case HERMES_HDIV_SPACE: norm = HERMES_HDIV_NORM; break; case HERMES_L2_SPACE: norm = HERMES_L2_NORM; break; default: error("Unknown space type in OGProjection<Scalar>::project_global()."); } } else norm = proj_norms[i]; // FIXME - memory leak - create Projection class and encapsulate this function project_global(...) // maybe in more general form found[i] = 1; // Jacobian. proj_wf->add_matrix_form(new ProjectionMatrixFormVol(i, i, norm)); // Residual. proj_wf->add_vector_form(new ProjectionVectorFormVol(i, source_meshfns[i], norm)); } for (int i=0; i < n; i++) { if (found[i] == 0) { warn("Index of component: %d\n", i); error("Wrong projection norm in project_global()."); } } project_internal(spaces, proj_wf, target_vec, matrix_solver_type); }
void OGProjection<Scalar>::project_global(SpaceSharedPtr<Scalar> space, MeshFunctionSharedPtr<Scalar> source_meshfn, Scalar* target_vec, NormType proj_norm) { // Sanity checks. if(target_vec == nullptr) throw Exceptions::NullException(3); // If projection norm is not provided, set it // to match the type of the space. NormType norm = HERMES_UNSET_NORM; if(proj_norm == HERMES_UNSET_NORM) { SpaceType space_type = space->get_type(); switch (space_type) { case HERMES_H1_SPACE: norm = HERMES_H1_NORM; break; case HERMES_HCURL_SPACE: norm = HERMES_HCURL_NORM; break; case HERMES_HDIV_SPACE: norm = HERMES_HDIV_NORM; break; case HERMES_L2_SPACE: norm = HERMES_L2_NORM; break; case HERMES_L2_MARKERWISE_CONST_SPACE: norm = HERMES_L2_NORM; break; default: throw Hermes::Exceptions::Exception("Unknown space type in OGProjection<Scalar>::project_global()."); } } else norm = proj_norm; // Define temporary projection weak form. WeakForm<Scalar>* proj_wf = new WeakForm<Scalar>(1); proj_wf->set_verbose_output(false); proj_wf->set_ext(source_meshfn); // Add Jacobian. proj_wf->add_matrix_form(new MatrixDefaultNormFormVol<Scalar>(0, 0, norm)); // Add Residual. proj_wf->add_vector_form(new VectorDefaultNormFormVol<Scalar>(0, norm)); // Call main function. project_internal(space, proj_wf, target_vec); // Clean up. delete proj_wf; }
static ssize_t store_projection_verify(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { int value; sscanf(buf, "%d\n", &value); printk(KERN_INFO "[%s] selected internal pattern : %d\n", __func__, value); if (value == CURTAIN_ON) { if (status != PRJ_ON_INTERNAL) return count; DPPDATAFLASH(Output_Curtain_Enable); } else if (value == CURTAIN_OFF) { if (status != PRJ_ON_INTERNAL) return count; DPPDATAFLASH(Output_Curtain_Disable); } else { saved_pattern = value; project_internal(value); } return count; }
void OGProjection::project_global(Hermes::Tuple<Space *> spaces, Hermes::Tuple<MeshFunction*> source_meshfns, scalar* target_vec, MatrixSolverType matrix_solver, Hermes::Tuple<ProjNormType> proj_norms) { _F_ int n = spaces.size(); // define temporary projection weak form WeakForm* proj_wf = new WeakForm(n); int found[100]; for (int i = 0; i < 100; i++) found[i] = 0; for (int i = 0; i < n; i++) { int norm; if (proj_norms == Hermes::Tuple<ProjNormType>()) { ESpaceType space_type = spaces[i]->get_type(); switch (space_type) { case HERMES_H1_SPACE: norm = HERMES_H1_NORM; break; case HERMES_HCURL_SPACE: norm = HERMES_HCURL_NORM; break; case HERMES_HDIV_SPACE: norm = HERMES_HDIV_NORM; break; case HERMES_L2_SPACE: norm = HERMES_L2_NORM; break; default: error("Unknown space type in OGProjection::project_global()."); } } else norm = proj_norms[i]; if (norm == HERMES_H1_NORM) { found[i] = 1; proj_wf->add_matrix_form(i, i, H1projection_biform<double, scalar>, H1projection_biform<Ord, Ord>); proj_wf->add_vector_form(i, H1projection_liform<double, scalar>, H1projection_liform<Ord, Ord>, HERMES_ANY, source_meshfns[i]); } if (norm == HERMES_H1_SEMINORM) { found[i] = 1; proj_wf->add_matrix_form(i, i, H1_semi_projection_biform<double, scalar>, H1_semi_projection_biform<Ord, Ord>); proj_wf->add_vector_form(i, H1_semi_projection_liform<double, scalar>, H1_semi_projection_liform<Ord, Ord>, HERMES_ANY, source_meshfns[i]); } if (norm == HERMES_HCURL_NORM) { found[i] = 1; proj_wf->add_matrix_form(i, i, Hcurlprojection_biform<double, scalar>, Hcurlprojection_biform<Ord, Ord>); proj_wf->add_vector_form(i, Hcurlprojection_liform<double, scalar>, Hcurlprojection_liform<Ord, Ord>, HERMES_ANY, source_meshfns[i]); } if (norm == HERMES_HDIV_NORM) { found[i] = 1; proj_wf->add_matrix_form(i, i, Hdivprojection_biform<double, scalar>, Hdivprojection_biform<Ord, Ord>); proj_wf->add_vector_form(i, Hdivprojection_liform<double, scalar>, Hdivprojection_liform<Ord, Ord>, HERMES_ANY, source_meshfns[i]); } if (norm == HERMES_L2_NORM) { found[i] = 1; proj_wf->add_matrix_form(i, i, L2projection_biform<double, scalar>, L2projection_biform<Ord, Ord>); proj_wf->add_vector_form(i, L2projection_liform<double, scalar>, L2projection_liform<Ord, Ord>, HERMES_ANY, source_meshfns[i]); } } for (int i=0; i < n; i++) { if (found[i] == 0) { warn("index of component: %d\n", i); error("Wrong projection norm in project_global()."); } } project_internal(spaces, proj_wf, target_vec, matrix_solver); }