fn handle_constraints(&self, x: &mut Vector, ksi: &[f64]) -> Result<Option<usize>, StrError> {
        const TOL: f64 = 1e-13;
        if self.ndim == 2 {
            if f64::abs(-1.0 - ksi[1]) < TOL {
                // bottom => e = 0
                if let Some(ct) = self.edge_constraints.get(&0) {
                    if self.apply_constraint_2d(x, ct)? {
                        return Ok(Some(0));
                    }
                }
            }
            if f64::abs(1.0 - ksi[0]) < TOL {
                // right => e = 1
                if let Some(ct) = self.edge_constraints.get(&1) {
                    if self.apply_constraint_2d(x, ct)? {
                        return Ok(Some(1));
                    }
                }
            }
            if f64::abs(1.0 - ksi[1]) < TOL {
                // top => e = 2
                if let Some(ct) = self.edge_constraints.get(&2) {
                    if self.apply_constraint_2d(x, ct)? {
                        return Ok(Some(2));
                    }
                }
            }
            if f64::abs(-1.0 - ksi[0]) < TOL {
                // left => e = 3
                if let Some(ct) = self.edge_constraints.get(&3) {
                    if self.apply_constraint_2d(x, ct)? {
                        return Ok(Some(3));
                    }
                }
            }
        } else {
            if f64::abs(-1.0 - ksi[0]) < TOL {
                // negative x => f = 0
                if let Some(ct) = self.face_constraints.get(&0) {
                    if self.apply_constraint_3d(x, ct)? {
                        return Ok(Some(0));
                    }
                }
            }
            if f64::abs(1.0 - ksi[0]) < TOL {
                // positive x => f = 1
                if let Some(ct) = self.face_constraints.get(&1) {
                    if self.apply_constraint_3d(x, ct)? {
                        return Ok(Some(1));
                    }
                }
            }
            if f64::abs(-1.0 - ksi[1]) < TOL {
                // negative y => f = 2
                if let Some(ct) = self.face_constraints.get(&2) {
                    if self.apply_constraint_3d(x, ct)? {
                        return Ok(Some(2));
                    }
                }
            }
            if f64::abs(1.0 - ksi[1]) < TOL {
                // positive y => f = 3
                if let Some(ct) = self.face_constraints.get(&3) {
                    if self.apply_constraint_3d(x, ct)? {
                        return Ok(Some(3));
                    }
                }
            }
            if f64::abs(-1.0 - ksi[2]) < TOL {
                // negative z => f = 4
                if let Some(ct) = self.face_constraints.get(&4) {
                    if self.apply_constraint_3d(x, ct)? {
                        return Ok(Some(4));
                    }
                }
            }
            if f64::abs(1.0 - ksi[2]) < TOL {
                // positive z => f = 5
                if let Some(ct) = self.face_constraints.get(&5) {
                    if self.apply_constraint_3d(x, ct)? {
                        return Ok(Some(5));
                    }
                }
            }
        }
        Ok(None)
    }
/// Handles constraints
///
/// Returns the local index of the edge or face corresponding to the side
/// where the constraint has been applied.
/// Returns None if the point is not on a constrained side.
Handles constraints
Returns the local index of the edge or face corresponding to the side
where the constraint has been applied.
Returns None if the point is not on a constrained side.
Handles constraints Returns the local index of the edge or face corresponding to the side where the constraint has been applied . Returns None if the point is not on a constrained side .
fn handle_constraints(&self, x: &mut Vector, ksi: &[f64]) -> Result<Option<usize>, StrError> {
        const TOL: f64 = 1e-13;
        if self.ndim == 2 {
            if f64::abs(-1.0 - ksi[1]) < TOL {
                // bottom => e = 0
                if let Some(ct) = self.edge_constraints.get(&0) {
                    if self.apply_constraint_2d(x, ct)? {
                        return Ok(Some(0));
                    }
                }
            }
            if f64::abs(1.0 - ksi[0]) < TOL {
                // right => e = 1
                if let Some(ct) = self.edge_constraints.get(&1) {
                    if self.apply_constraint_2d(x, ct)? {
                        return Ok(Some(1));
                    }
                }
            }
            if f64::abs(1.0 - ksi[1]) < TOL {
                // top => e = 2
                if let Some(ct) = self.edge_constraints.get(&2) {
                    if self.apply_constraint_2d(x, ct)? {
                        return Ok(Some(2));
                    }
                }
            }
            if f64::abs(-1.0 - ksi[0]) < TOL {
                // left => e = 3
                if let Some(ct) = self.edge_constraints.get(&3) {
                    if self.apply_constraint_2d(x, ct)? {
                        return Ok(Some(3));
                    }
                }
            }
        } else {
            if f64::abs(-1.0 - ksi[0]) < TOL {
                // negative x => f = 0
                if let Some(ct) = self.face_constraints.get(&0) {
                    if self.apply_constraint_3d(x, ct)? {
                        return Ok(Some(0));
                    }
                }
            }
            if f64::abs(1.0 - ksi[0]) < TOL {
                // positive x => f = 1
                if let Some(ct) = self.face_constraints.get(&1) {
                    if self.apply_constraint_3d(x, ct)? {
                        return Ok(Some(1));
                    }
                }
            }
            if f64::abs(-1.0 - ksi[1]) < TOL {
                // negative y => f = 2
                if let Some(ct) = self.face_constraints.get(&2) {
                    if self.apply_constraint_3d(x, ct)? {
                        return Ok(Some(2));
                    }
                }
            }
            if f64::abs(1.0 - ksi[1]) < TOL {
                // positive y => f = 3
                if let Some(ct) = self.face_constraints.get(&3) {
                    if self.apply_constraint_3d(x, ct)? {
                        return Ok(Some(3));
                    }
                }
            }
            if f64::abs(-1.0 - ksi[2]) < TOL {
                // negative z => f = 4
                if let Some(ct) = self.face_constraints.get(&4) {
                    if self.apply_constraint_3d(x, ct)? {
                        return Ok(Some(4));
                    }
                }
            }
            if f64::abs(1.0 - ksi[2]) < TOL {
                // positive z => f = 5
                if let Some(ct) = self.face_constraints.get(&5) {
                    if self.apply_constraint_3d(x, ct)? {
                        return Ok(Some(5));
                    }
                }
            }
        }
        Ok(None)
    }
fn handle_constraints ( & self , x : & mut Vector , ksi : & [ f64 ] ) -> Result < Option < usize > , StrError > { const TOL : f64 = 1e-13 ; if self . ndim == 2 { if f64 :: abs ( - 1.0 - ksi [ 1 ] ) < TOL { // bottom => e = 0 if let Some ( ct ) = self . edge_constraints . get ( & 0 ) { if self . apply_constraint_2d ( x , ct ) ? { return Ok ( Some ( 0 ) ) ; } } } if f64 :: abs ( 1.0 - ksi [ 0 ] ) < TOL { // right => e = 1 if let Some ( ct ) = self . edge_constraints . get ( & 1 ) { if self . apply_constraint_2d ( x , ct ) ? { return Ok ( Some ( 1 ) ) ; } } } if f64 :: abs ( 1.0 - ksi [ 1 ] ) < TOL { // top => e = 2 if let Some ( ct ) = self . edge_constraints . get ( & 2 ) { if self . apply_constraint_2d ( x , ct ) ? { return Ok ( Some ( 2 ) ) ; } } } if f64 :: abs ( - 1.0 - ksi [ 0 ] ) < TOL { // left => e = 3 if let Some ( ct ) = self . edge_constraints . get ( & 3 ) { if self . apply_constraint_2d ( x , ct ) ? { return Ok ( Some ( 3 ) ) ; } } } } else { if f64 :: abs ( - 1.0 - ksi [ 0 ] ) < TOL { // negative x => f = 0 if let Some ( ct ) = self . face_constraints . get ( & 0 ) { if self . apply_constraint_3d ( x , ct ) ? { return Ok ( Some ( 0 ) ) ; } } } if f64 :: abs ( 1.0 - ksi [ 0 ] ) < TOL { // positive x => f = 1 if let Some ( ct ) = self . face_constraints . get ( & 1 ) { if self . apply_constraint_3d ( x , ct ) ? { return Ok ( Some ( 1 ) ) ; } } } if f64 :: abs ( - 1.0 - ksi [ 1 ] ) < TOL { // negative y => f = 2 if let Some ( ct ) = self . face_constraints . get ( & 2 ) { if self . apply_constraint_3d ( x , ct ) ? { return Ok ( Some ( 2 ) ) ; } } } if f64 :: abs ( 1.0 - ksi [ 1 ] ) < TOL { // positive y => f = 3 if let Some ( ct ) = self . face_constraints . get ( & 3 ) { if self . apply_constraint_3d ( x , ct ) ? { return Ok ( Some ( 3 ) ) ; } } } if f64 :: abs ( - 1.0 - ksi [ 2 ] ) < TOL { // negative z => f = 4 if let Some ( ct ) = self . face_constraints . get ( & 4 ) { if self . apply_constraint_3d ( x , ct ) ? { return Ok ( Some ( 4 ) ) ; } } } if f64 :: abs ( 1.0 - ksi [ 2 ] ) < TOL { // positive z => f = 5 if let Some ( ct ) = self . face_constraints . get ( & 5 ) { if self . apply_constraint_3d ( x , ct ) ? { return Ok ( Some ( 5 ) ) ; } } } } Ok ( None ) }
Handles constraints
Returns the local index of the edge or face corresponding to the side
where the constraint has been applied.
Handles constraints Returns the local index of the edge or face corresponding to the side where the constraint has been applied .
&self
x
&mut Vector
ksi
&[f64]
&self
x
&mut Vector
ksi
&[f64]